<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-16 4:04 GMT-04:00 <a href="mailto:jarod_v6@libero.it">jarod_v6@libero.it</a> <span dir="ltr"><<a href="mailto:jarod_v6@libero.it" target="_blank">jarod_v6@libero.it</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi there!!!<br>
I have a file with this data<br>
['uc002uvo.3 ', 'uc001mae.1']<br>
['uc010dya.2 ', 'uc001kko.2']<br>
</blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I want to replace of the things after the dots, so I want to have a file with<br>
this output:<br>
<br>
['uc002uvo ', 'uc001mae']<br>
['uc010dya ', 'uc001kko']<br>
...<br>
<br>
I try to use regular expression but I have a strange output<br></blockquote><div><br></div><div>I'm one of those who doesn't choose regex first for string manipulation that are simpler without them. <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
with open("non_annotati.csv") as p:<br>
for i in p:<br>
lines= i.rstrip("\n").split("\t")<br>
mit = re.sub(r'(\.\d$)','',lines[0])<br>
mit2 = re.sub(r'(\.\d$)','',lines[1])<br>
print mit,mit2<br></blockquote><div><br> mit = lines[0].split('.')[0] <br>
</div><div> mit = lines[1].split('.')[0] <br><br>>>> s = 'uc003klv.2 '<br>>>> s.split('.')<br>['uc003klv', '2 ']<br><br></div><div><br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
uc003klv.2 uc010lxj<br>
uc001tzy.2 uc011kzk<br>
uc010qdj.1 uc001iku<br>
uc004coe.2 uc002vmf<br>
uc002dvw.2 uc004bxn<br>
uc001dmp.2 uc001dmo<br>
uc002rqd.2 uc010ynl<br>
uc010cvm.1 uc002qjc<br>
uc003ewy.3 uc003hgx<br>
uc002ejy.2 uc003mvb<br>
uc002fou.1 uc010ilx<br>
uc003vhf.2 uc010qlo<br>
uc003mix.2 uc010tdt<br>
uc002nez.1 uc003wxe<br>
uc011cpu.1 uc002keg<br>
uc001ovu.2 uc011dne<br>
uc010zfg.1 uc001jvq<br>
uc010jlf.2 uc011azi<br>
uc001ors.3 uc001vzx<br>
uc010tyt.1 uc003vih<br>
uc010fde.2 uc002xgq<br>
uc010bit.1 uc003zle<br>
uc010xcb.1 uc010wsg<br>
uc011acg.1 uc009wlp<br>
uc002bnj.2 uc004ckd<br>
<br>
<br>
Where is the error? what is wrong in my regular expression code?<br>
<br>
<br>
_______________________________________________<br>
Tutor maillist - <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="https://mail.python.org/mailman/listinfo/tutor" target="_blank">https://mail.python.org/mailman/listinfo/tutor</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><div>Joel Goldstick<br></div><a href="http://joelgoldstick.com" target="_blank">http://joelgoldstick.com</a><br></div>
</div></div>