Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 RaiMan posted a new comment: I made a faq, that should explain some of your doubts: faq 2711 If you are sure, that what you get from clipboard only contains ascii characters, the this is the easiest approach: Names = str(App.getClipboard()); then you could just forget about unicode in the following workflow. If you have to be aware of unicode from the clipboard, then you simply have to take care, that all variables are unicode afterwards. Names = App.getClipboard(); # ... convert Names to a list Names2 = [u'corazona', u'paflio'] NamesSelected = [i for i, v in enumerate(Names) if v not in Names2] -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya gave more information on the question: But RaiMan you are setting Names =''' name1 name2 name3 ''' an then with simply using... namelist = names.split()[0:] printout: ['name1', 'name2', 'name3'] shure, it works fine, but In my case, I receive the name1, name2, name3 from clipboard, and so I use Names = App.getClipboard(); in order to store all names in Names variable but doing so, I don't know why, my Names variable is different than the Names variable you are setting your Names var Names ='''name1, name2, name3 ''' if you print them they seem the same, but when doing the split both have different results So when I use namelist = names.split()[0:] I get... [u'name1', u'name2', u'name3'] How I can get a variable like the one that you set? I guess the variable I have is not a multine variable, but a string with many carriage returns Also I have tried using regex in order to simply remove the \r\n from my Names variable newNames = re.sub(r\r\n, , Names) why is that??? please tell me, how can I remove the \r\n (new lines) form my clipboard, Iam stuck with this THanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya gave more information on the question: I would like to convert Names into... 'corazona', 'Pebleo00', 'cofriasd', 'paflio', cuz there is another list that I need to compere it to... Names2 = ['corazona', 'paflio'] using... NamesSelected = [i for i, v in enumerate(Names) if v not in Names2] if I compare the clipboard as it is, I get an unespected result, How could I convert this unicode string enconced in utf-8 into 'corazona', 'Pebleo00', 'cofriasd', 'paflio', Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Status: Answered = Open eduardobedoya is still having a problem: How can I use it as a list of strings/? -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya gave more information on the question: I have remove the newlines from my Names variable using... newNames= re.sub(r(?m)(\n), , Names) so I get... name1 name2 name3 but, still when I do... namelist = names.split()[0:] I get... [u'name1', u'name2', u'name3'] So I guess the matter is that the clipboard is in utf-8 How can I change it please any hint -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya posted a new comment: Thanks Rainman, currently Im reading this https://docs.python.org/2/library/string.html?highlight=split#string.split do you suggest another better tutorial? Thanks! -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Status: Open = Answered RaiMan proposed the following answer: it is exactly what you need. As often with your questions: a look into Python language guide would have told you, that something looking like u'some text' is a unicode string encoded in utf-8 (which is what you get from clipboard). so simply use it as a list of strings. this is only the way, how print tells you, that the strings are unicode strings. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya posted a new comment: solved using this... s= u'£10' s.encode('utf8') I know its said taht the u is purely used to let you know it's a unicode string in the representation, that it will not affect the string itself, that unicode strings work exactly as normal strings. But this is not the case in Sikuli xD I could not leave it as unicode string because of the reason explained in my comment above. There is an special python manual for Sikuli purposes xD -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya posted a new comment: solved using this... s= u'£10' s.encode('utf8') I know its said taht the u is purely used to let you know it's a unicode string in the representation, that it will not affect the string itself, that unicode strings work exactly as normal strings. But this is not the case in Sikuli xD I could not leave it as unicode string because of the reason explained above. There is an special python manual for Sikuli purposes xD -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Status: Solved = Open eduardobedoya is still having a problem: But RaiMan you are setting Names =''' name1 name2 name3 ''' an then with simply using... namelist = names.split()[0:] printout: ['name1', 'name2', 'name3'] shure, it works fine, but In my case, I receive the name1, name2, name3 from clipboard, and so I use Names = App.getClipboard(); in order to store all names in Names variable but doing so, my Names variable is very different than the Names you are setting Names ='''name1, name2, name3 ''' So when I use namelist = names.split()[0:] I get... [u'name1', u'name2', u'name3'] How I can get a variable like the one that you set? I guess the variable I have is not a multine variable, but a string with many carriage returns Also I have tried using regex in order to simply remove the \r\n from my Names variable newNames = re.sub(r\r\n, , Names) why is that??? please tell me, how can I remove the \r\n (new lines) form my clipboard, Iam stuck with this THanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Status: Open = Solved eduardobedoya confirmed that the question is solved: solved using this... s= u'£10' s.encode('utf8') I know its said taht the u is purely used to let you know it's a unicode string in the representation, that it will not affect the string itself. But I could not leave it as unicode string because the reason explained above. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya gave more information on the question: I would like to convert Names into... 'corazona', 'Pebleo00', 'cofriasd', 'paflio', cuz I have another list that I need to compere it to Names2 = ['corazona', 'paflio'] NamesSelected = [i for i, v in enumerate(Names) if v not in Names2] How could I convert this unicode string enconced in utf-8 into 'corazona', 'Pebleo00', 'cofriasd', 'paflio', Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 RaiMan posted a new comment: name = some text some text is the so called here text (available in most scripting languages), that allows to easily define a multiline text inline in the code. mostly used for initialisation and testing (instead of using some file or other more complex things) So in your case I simply simulated what I supposed you get from clipboard. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Status: Answered = Solved eduardobedoya confirmed that the question is solved: Thanks Eugene S, that solved my question. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 RaiMan posted a new comment: some Python tutorial ;-) Names = Names = #name1 #name2 ~name3 namelist = Names.split()[2:] for i in range(len(namelist)): namelist[i] = namelist[i][1:] print namelist printout: ['name1', 'name2', 'name3'] -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya posted a new comment: thanks Rainman! please do you have alink, I have to read all about this I would like to find a good site with many examples, Thanks Again. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya posted a new comment: thanks Rainman! It is just that I have tried it and it prints [u'ame1', u'ame2', u'ame3'] I have tried namelist = Names.split()[1:] for i in range(len(namelist)): namelist[i] = namelist[i][0:] print namelist and it prints [u'name1', u'name2', u'name3'] please do you have alink, I have to read all about this Im currently reading docs. Thanks Again Man -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya posted a new comment: thanks Rainman! It is just that I have tried it and it prints [u'ame1', u'ame2', u'ame3'] I have tried namelist = Names.split()[1:] for i in range(len(namelist)): namelist[i] = namelist[i][0:] print namelist and it prints [u'name1', u'name2', u'name3'] please do you have alink, I have to read all about this Im currently reading docs. Thanks Again Man -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 eduardobedoya posted a new comment: Thanks Rainman! It worked, I just would like to understand why the and the Name = (inside another Name) please could you suggest me some related tutos? Thanks Again man. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Description changed to: In sikuli I've get a multiline string from clipboard like this... Names = App.getClipboard(); Name = #corazona #Pebleo00 #cofriasd «paflio and I have use this regex to delete the first character if it is not in x00-x7f hex range or is not a word, or is a digit import re Names = re.sub(r(?m)^([^\x00-\x7F]+|\W|\d), , Names) So now... Names = corazona Pebleo00 cofriasd paflio I am having trouble with the second regex that convert Names into a kinda List (I did the regex first in .NET) I would like to convert Names into... 'corazona', 'Pebleo00', 'cofriasd', 'paflio' So then I can apply... NamesAsList = eval(Names) in order to get a proper List to work with How could I do this in python? is it necessary to use regex, or there is other way to do this in python? This is how I did this with .Net regex Text to find: (.*[^$])(\r\n|\z) Replace with: '$1',% % Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
[Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
New question #265776 on Sikuli: https://answers.launchpad.net/sikuli/+question/265776 In sikuli I've get a multiline string from clipboard (content from a third OCR app) like this... Names = App.getClipboard(); Name = #corazona #Pebleo00 #cofriasd «paflio and I have use this regex to delete the first character if it is not in x00-x7f hex range or is not a word, or is a digit import re Names = re.sub(r(?m)^([^\x00-\x7F]+|\W|\d), , Names) So now... Names = corazona Pebleo00 cofriasd paflio I am having trouble with the second regex that convert Names into a kinda List (I did the regex first in .NET) I would like to convert Names into... 'corazona', 'Pebleo00', 'cofriasd', 'paflio' So then I can apply... NamesAsList = eval(Names) in order to get a proper List to work with How could I do this in python? is it necessary to use regex, or there is other way to do this in python? This is how I did this with .Net regex Text to find: (.*[^$])(\r\n|\z) Replace with: '$1',% % Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Description changed to: In sikuli I've get a multiline string from clipboard like this... Names = App.getClipboard(); Name = #corazona #Pebleo00 #cofriasd «paflio and I have use this regex to delete the first character if it is not in x00-x7f hex range or is not a word, or is a digit import re Names = re.sub(r(?m)^([^\x00-\x7F]+|\W|\d), , Names) So now... Names = corazona Pebleo00 cofriasd paflio I am having trouble with the second regex that convert Names into a kinda List (I did the regex first in .NET) I would like to convert Names into... 'corazona', 'Pebleo00', 'cofriasd', 'paflio' So then I can apply... NamesAsList = eval(Names) in order to get a proper List to work with How could I do this in python? is it necessary to use regex, or there is other way to do this in python? This is how I did this with .Net regex Text to find: (.*[^$])(\r\n|\z) Replace with: '$1',% % Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Description changed to: In sikuli I've get a multiline string from clipboard like this... Names = App.getClipboard(); Name = #corazona #Pebleo00 #cofriasd «paflio and I have use this regex to delete the first character if it is not in x00-x7f hex range or is not a word, or is a digit import re Names = re.sub(r(?m)^([^\x00-\x7F]+|\W|\d), , Names) So now... Names = corazona Pebleo00 cofriasd paflio I am having trouble with the second regex that convert Names into a kinda List I would like to convert Names into... 'corazona', 'Pebleo00', 'cofriasd', 'paflio', So sikuli can then recognize it as a List by using... NamesAsList = eval(Names) in order to get a proper List to work with How could I do this in python? is it necessary to use regex, or there is other way to do this in python? I have already done this but using .Net regex, I just don't know how to do it in python, I have googled it with no result. This is how I did it using .Net regex Text to find: (.*[^$])(\r\n|\z) Replace with: '$1',% % Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Description changed to: In sikuli I've get a multiline string from clipboard like this... Names = App.getClipboard(); Name = #corazona #Pebleo00 #cofriasd «paflio and I have use this regex to delete the first character if it is not in x00-x7f hex range or is not a word, or is a digit import re Names = re.sub(r(?m)^([^\x00-\x7F]+|\W|\d), , Names) So now... Names = corazona Pebleo00 cofriasd paflio I am having trouble with the second regex that convert Names into a kinda List (I did the regex first in .NET) I would like to convert Names into... 'corazona', 'Pebleo00', 'cofriasd', 'paflio', So sikuli can then recognize it as a List by using... NamesAsList = eval(Names) in order to get a proper List to work with How could I do this in python? is it necessary to use regex, or there is other way to do this in python? This is how I did it using .Net regex Text to find: (.*[^$])(\r\n|\z) Replace with: '$1',% % Thanks Advanced. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp
Re: [Sikuli-driver] [Question #265776]: Is it possible to join a multiline string using python regex in Sikuli??
Question #265776 on Sikuli changed: https://answers.launchpad.net/sikuli/+question/265776 Status: Open = Answered Eugene S proposed the following answer: All standard Python functionality will work in Sikuli as well. Your question is purely Python. Refer to Python documentation. -- You received this question notification because you are a member of Sikuli Drivers, which is an answer contact for Sikuli. ___ Mailing list: https://launchpad.net/~sikuli-driver Post to : sikuli-driver@lists.launchpad.net Unsubscribe : https://launchpad.net/~sikuli-driver More help : https://help.launchpad.net/ListHelp