[00:02:21] lukas: cool :). Worst webpage design EVER though LOL [00:02:59] kalken: yeah, but this guy had a talk at CCC event nevertheless :D [00:03:48] okay. I'm working a bit with backbone.js now :D [00:03:53] its cool :D [00:06:43] :) [00:46:59] http://synearth.net/ [00:47:02] Title:  News for a Synergic Earth (at synearth.net) [01:47:40] *** Quits: lukas (lukas@RBOSE-gkfu2h) (Connection closed) [03:54:08] *** Quits: kalken (default@RBOSE-1a724n.bredband.comhem.se) (Ping timeout: 241 seconds) [07:02:28] *** Joins: DNS777 (DNS777@RBOSE-tqb8pp.superkabel.de) [07:05:16] !morning all [07:05:16] ACTION wishes everybody in #RBOSE a wonderful morning and a great start in the day! [07:07:24] *** Quits: DNS777 (DNS777@search.for.freedom) (Quit: jumpin' jumpin') [07:07:27] *** Joins: DNS777 (DNS777@RBOSE-tqb8pp.superkabel.de) [07:58:39] *** Joins: Kebap (Max@RBOSE-a5rtsv.adsl.alicedsl.de) [07:58:52] -nobody- Kebap23 has joined on FREENODE [07:58:54] -nobody- mode change by ChanServ on FREENODE: +v Kebap23 [08:03:07] *** Quits: DNS777 (DNS777@NetAdmin.RBOSE) (Quit: Coyote finally caught me) [08:03:16] *** Joins: DNS777 (DNS777@RBOSE-tqb8pp.superkabel.de) [09:18:22] *** Quits: Kebap (Max@RBOSE-a5rtsv.adsl.alicedsl.de) (Quit: adios amigos) [09:18:23] -nobody- Kebap23 has quit FREENODE (Quit: adios amigos) [09:50:18] -nobody- DNS777` has joined on FREENODE [09:50:19] -nobody- mode change by ChanServ on FREENODE: +v DNS777` [09:52:47] -nobody- nick change by DNS777` to DNS777 on FREENODE [11:02:11] *** Joins: test (qwebirc@RBOSE-qk5qqv.a1.net) [11:02:30] *** Quits: test (qwebirc@RBOSE-qk5qqv.a1.net) (Quit: Page closed) [11:20:53] *** Joins: kman (kman@RBOSE-hhm.9h0.94.93.IP) [11:25:06] *** Quits: kman (kman@RBOSE-hhm.9h0.94.93.IP) (Connection closed) [11:34:20] *** Joins: lukas (lukas@RBOSE-gkfu2h) [12:59:31] *** Joins: kman (kman@RBOSE-651.4nl.121.192.IP) [13:06:41] Herroh :3 [13:17:04] Do we anyone python savvy in the house? [13:29:41] *** Parts: Nauti (katt@RBOSE-q6iqr1.cust.bredbandsbolaget.se) [13:38:27] hola [13:38:54] * DNS777 looks at lukas [13:39:42] kman: Why? Are you writing up some code? [13:40:22] Slush-, What if i was? ^^ [13:40:41] then you are 1337 [13:40:44] lol [13:41:25] I am grateful for this title. [13:41:54] Slush-, Herro to you btw. Never talked to you before. *hand shake* [13:42:31] Hello to you too! *hand shake, hand shake* [13:44:14] Well im trying to copy some numbers from a data file and im not really sure about how to write the re.search part. [13:48:41] this can be difficult if the numbers in the data file dont have any individual characters to identify [13:51:46] Yeah.. Im kind of coming to the same conclusion. [13:52:19] do the lines frequently change in the db? [13:52:27] i think so [13:53:17] Hmm no i think iv got it now. At least how i can break it down. [13:58:06] :) [14:02:55] hi kman! :D [14:04:13] can you paste sample of the file at pastebin and tell exactly what you want to extract? [14:06:31] *A wild lukas appears! He used Productive Straightforwardness. Its super effective!* [14:06:33] Yeah sure. [14:07:51] sorry for the lags on my side, i don't sit here all the time [14:11:10] http://pastebin.com/cDGJe8TL [14:11:12] Title:  [Python] kman - Pastebin.com (at pastebin.com) [14:11:15] Its really no problem [14:11:30] I think i know how to do it, but id appreciate your input as well. [14:13:31] kman, you may do it with re module or without it, we could test what is faster for lots of data [14:14:10] re.module you say? I'll read up on it. [14:17:09] kman you mentioned re.search and it's a method from the re python module :) [14:17:25] Yep! Im with you that far. [14:36:28] I could just got for re.search and just copy specific groups from it. [14:41:04] lukas, should i perhaps first do a re.search for the area in the data file where the numbers i want are, and then search in that area for the numbers i need? [14:41:21] Wow, that was poorly formulated, but perhaps you get me. [14:45:01] kman: http://pastebin.com/SemAdDd6 [14:45:03] Title:  [Python] text = """ Summary of the potential surface scan: N r12 SCF - Pastebin.com (at pastebin.com) [14:46:05] ^what i would have written, given 30 more minutes [14:46:48] what does the ? take care of? [14:47:21] *** Joins: kalken (default@RBOSE-1a724n.bredband.comhem.se) [14:47:40] o/ kalken [14:49:30] kman, quote: Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ab? will match either ‘a’ or ‘ab’. [14:50:05] Going to grab some food. [14:50:06] Bbl [14:50:10] so you may have the minus before the number or not, no other case :) [14:50:31] and only one minus ofc [14:50:37] enjoy! [14:59:05] *** Quits: kman (kman@RBOSE-651.4nl.121.192.IP) (Ping timeout: 241 seconds) [15:08:34] http://pastebin.com/D1kyGDSH this will be even better, DNS777 if i miss kman, please forward it to him [15:08:36] Title:  [Python] text = """ Summary of the potential surface scan: N r12 SCF - Pastebin.com (at pastebin.com) [15:09:52] ok [15:17:12] lukas you can also use memserv ;) [15:17:31] i just remember this service heh [15:17:55] > /ms help [15:18:11] or /msg memserv help [15:30:20] true [15:47:48] *** Joins: Hakufus (jonte@RBOSE-aa2ikg.bredband.comhem.se) [15:47:48] *** Quits: Hakufu_ (jonte@RBOSE-aa2ikg.bredband.comhem.se) (Connection closed) [16:05:31] http://www.youtube.com/watch?v=F1jdrpsNPtg [16:05:33] Title:  Bachmann Chairman Resigns, Endorses Ron Paul on Live TV - YouTube (at www.youtube.com) [16:13:07] *** Joins: kman (kman@RBOSE-651.4nl.121.192.IP) [16:24:34] *** Quits: kman (kman@RBOSE-651.4nl.121.192.IP) (Connection closed) [16:37:05] *** Joins: kman (kman@RBOSE-651.4nl.121.192.IP) [16:39:36] lukas, so why use re.compile instead of search? [16:40:18] and, regardless of what index i use for the results.group(index) i get the entire match. [16:41:05] re.compile precompiles a pattern so it's faster to search later, because otherwise each time you search it will compile it again and again i think on the fly, can be wrong on that [16:41:39] results.groups()[index_here] is not the same :) [16:42:09] kman, check also this: http://pastebin.com/D1kyGDSH [16:42:09] kman: for you http://pastebin.com/D1kyGDSH [16:42:11] Title:  [Python] text = """ Summary of the potential surface scan: N r12 SCF - Pastebin.com (at pastebin.com) [16:42:13] from lukas [16:42:14] hahaha [16:42:15] hahaha [16:42:16] :D [16:42:28] thx DNS777 :) [16:42:33] it looks like we are clones gnu damnit [16:42:37] rofl [16:42:41] lol [16:42:42] Arnt you? [16:43:15] :) [16:44:25] Well thanks for the code, but i dont want the first group in the re.compile [16:45:13] So i want to: print results.group(1,2) [16:45:16] kman, i used match instead of search in first example, that was the real difference, in the second example i used findall [16:45:30] Yeah [16:46:02] But im getting all of the groups regardless what index i use. [16:46:14] ---> python channel [16:46:50] kman, you did not specify any index so far, index is always in square brackets [] [16:47:36] you only passed some integers as parameters to the group() method [16:47:40] Yeah [16:47:53] But what if i want both 2 and 3 in the same print? [16:48:26] then you need to do it this way for example [16:48:32] Well i know how to get around that by just fiddling with some strings, [16:48:41] (let's assume you use the code from second example) [16:49:09] so we have: results = pattern.findall(text) [16:49:20] for r in results: [16:49:38] print r[1], r[2] [16:49:46] Oh ok. [16:50:22] Difference between findall and match being? [16:51:29] http://docs.python.org/library/re.html search for re.findall and re.match on that page :) [16:51:31] Title:  7.2. re — Regular expression operations Python v2.7.2 documentation (at docs.python.org) [16:53:39] ^^ [16:53:47] Thanks a lot! [16:54:09] and when it comes to first example, you could type after the line result = pattern.match(line) [16:54:37] print result.groups()[1], result.groups()[2] [16:54:46] Ah ok. [16:54:52] Awesome :3 [16:56:30] but this code can be written in many ways, the differences should be clear after a while :) [16:58:27] Well i can see that for manipulation of larger data sets and strings, it might be convenient to use the match object since they can be tested. [16:58:39] findall seems like the blunt-force brother of match [16:59:40] kman, if you are not going to print it out to the screen but want to store only r12 and SCF, you can use a compound expression for example or make a list/tuple/dict assigning values one by one [17:01:04] for example: list_reduced = [r[1], r[2] for r in results] [17:01:35] this will skip the N column, assuming we speak here about the second example [17:02:17] then if you print list_reduced you should see the difference [17:03:16] same without compound expression would require 3 lines: [17:03:25] list_reduced = [] [17:03:26] *** Joins: kman_ (kman@RBOSE-5iche5.mobileonline.telia.com) [17:03:43] for r in results: [17:03:55] Waa disced there for a sec. [17:04:07] Last line i saw was: reading the library [17:04:34] list_reduced.append([r[1], r[2]]) [17:04:47] oh [17:05:06] let me paste in query [17:06:53] *** Quits: kman (kman@RBOSE-651.4nl.121.192.IP) (Ping timeout: 241 seconds) [18:46:07] *** Joins: Hakufu (jonte@RBOSE-aa2ikg.bredband.comhem.se) [18:46:07] *** Quits: Hakufus (jonte@RBOSE-aa2ikg.bredband.comhem.se) (Connection closed) [18:55:19] *** Joins: Kebap (Max@RBOSE-a5rtsv.adsl.alicedsl.de) [18:55:35] -nobody- Kebap23 has joined on FREENODE [18:55:36] -nobody- mode change by ChanServ on FREENODE: +v Kebap23 [19:01:33] *** Quits: Hakufu (jonte@RBOSE-aa2ikg.bredband.comhem.se) (Connection closed) [19:01:50] *** Joins: Hakufu (jonte@RBOSE-aa2ikg.bredband.comhem.se) [19:05:49] *** Quits: kman_ (kman@RBOSE-5iche5.mobileonline.telia.com) (Ping timeout: 241 seconds) [19:16:23] *** Joins: Viper_ (qWEBirc@RBOSE-0mi0ml.pool.ukrtel.net) [19:16:41] *** Viper_ is now known as Evil [20:43:48] *** Quits: Evil (qWEBirc@RBOSE-0mi0ml.pool.ukrtel.net) (Quit: Page closed) [20:47:24] *** Joins: Evil (qWEBirc@RBOSE-4dg1es.pool.ukrtel.net) [21:57:00] *** Joins: Fodi69 (Fodi69@RBOSE-cau.7u5.2.84.IP) [22:16:23] *** Quits: Evil (qWEBirc@RBOSE-4dg1es.pool.ukrtel.net) (Quit: Page closed) [22:59:42] *** Quits: ZyaX (9jti8d8@RBOSE-5lntnm.bredband.comhem.se) (Ping timeout: 241 seconds) [23:19:20] *** Joins: Cyclo (Cyclo@RBOSE-pdk.uv3.156.78.IP) [23:28:40] *** Quits: Fodi69 (Fodi69@RBOSE-cau.7u5.2.84.IP) (Quit: KVIrc 4.1.1 Equilibrium http://www.kvirc.net/)