Re: [Tutor] Tutor Digest, Vol 127, Issue 12
>> I downloaded notepad++. Can you please help me how to run python script in >> notepad++? > > > I only played with notepad++ briefly but I seem to recall it had a menu with > commands to 'make' and 'run' a file. You could configure the commands > associated with those menus in the settings somewhere. Potentially relevant: http://stackoverflow.com/questions/1702586/how-to-execute-a-python-file-in-notepad I too have no experience with Notepad++, so hopefully there are others on the list that can chime in. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 127, Issue 12
On Thu, Sep 4, 2014 at 3:26 PM, Alan Gauld wrote: > On 04/09/14 21:37, Najam Qasim wrote: >> I downloaded notepad++. Can you please help me how to run python script in >> notepad++? > > I only played with notepad++ briefly but I seem to recall it had a menu with > commands to 'make' and 'run' a file. You could configure the commands > associated with those menus in the settings somewhere. I use Notepad++ all the time as my go-to text editor - but I don't use it as an IDE precisely, because it doesn't have an integrated interpreter/debugger/etc. There _is_ a Run menu, but it's just a generic program launcher; I think your memory is playing tricks on you as far as a Make command is concerned. Notepad++ does have a large plugin ecosystem, and there may be some IDE-ish plugins out there, but that's not really what the program is meant for. > Hopefully somebody who currently uses the editor can provide clearer help. > Meantime just save the file and run it from the Windows Explorer or (better) > an OS command prompt This would be my advice also. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 127, Issue 12
On 04/09/14 21:37, Najam Qasim wrote: Please do not include the entire digest in your mail, especially since none of it seems relevant to your post. Some members pay by the byte. I downloaded notepad++. Can you please help me how to run python script in notepad++? I only played with notepad++ briefly but I seem to recall it had a menu with commands to 'make' and 'run' a file. You could configure the commands associated with those menus in the settings somewhere. Hopefully somebody who currently uses the editor can provide clearer help. Meantime just save the file and run it from the Windows Explorer or (better) an OS command prompt HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] New to Python..Need help
These are all the files. No two filenames are the same swp.1120630020111.KLWX.0.0.5_PPI_v2 swp.1120630020143.KLWX.0.0.9_PPI_v3 swp.1120630020215.KLWX.0.1.3_PPI_v4 swp.1120630020247.KLWX.0.1.8_PPI_v5 swp.1120630020302.KLWX.0.2.4_PPI_v6 swp.1120630020316.KLWX.0.3.1_PPI_v7 swp.1120630020330.KLWX.0.4.0_PPI_v8 swp.1120630020344.KLWX.0.5.1_PPI_v9 swp.1120630020358.KLWX.0.6.4_PPI_v10 swp.1120630020411.KLWX.0.8.0_PPI_v11 swp.1120630020424.KLWX.0.10.0_PPI_v12 swp.1120630020437.KLWX.0.12.5_PPI_v13 swp.1120630020451.KLWX.0.15.6_PPI_v14 swp.1120630020504.KLWX.0.19.5_PPI_v15 On Thu, Sep 4, 2014 at 4:27 PM, Danny Yoo wrote: > On Thu, Sep 4, 2014 at 12:05 PM, taserian wrote: > > Is there anything different between the filenames aside from that suffix > > _vXX? If not, then you'll run into problems after the first filename is > > changed; further attempts won't allow the change, since there's already a > > file with that same name. > > > Ah. Nice catch! Yeah, that's a potential problem with the problem > statement. Felisha, please clarify this point, because it's a big > one. > -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) felisha.lawre...@gmail.com (email) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 127, Issue 12
I downloaded notepad++. Can you please help me how to run python script in notepad++? Thanks. Najam > On Sep 4, 2014, at 4:23 PM, tutor-requ...@python.org wrote: > > Send Tutor mailing list submissions to >tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, visit >https://mail.python.org/mailman/listinfo/tutor > or, via email, send a message with subject or body 'help' to >tutor-requ...@python.org > > You can reach the person managing the list at >tutor-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Tutor digest..." > > > Today's Topics: > > 1. New to Python..Need help (Felisha Lawrence) > 2. Re: New to Python..Need help (Joel Goldstick) > 3. Re: New to Python..Need help (taserian) > 4. Re: New to Python..Need help (Alan Gauld) > 5. Re: New to Python..Need help (Danny Yoo) > > > -- > > Message: 1 > Date: Thu, 4 Sep 2014 08:49:04 -0400 > From: Felisha Lawrence > To: tutor@python.org > Subject: [Tutor] New to Python..Need help > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > Hello, > I have a question regarding strings in python. I have a directory on my > MacBook Bro of about 13 files. I need to alter the file endings in > that directory. The files are on the order of > 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. > I need to remove the characters after the 'v' and replace with v20. All of > the endings of the files are sequential _v2, _v3,_v4, _v5. I need all of > these characters to be the same (i.e. v20). I would like to know which > modules are best to use, and how to use loops to alter them. Any help you > can provide would be great. > > > Thanks, > Felisha Lawrence > > -- > Felisha Lawrence > Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student > > NASA URC/BCCSO Graduate Fellow > NOAA NCAS Graduate Fellow > Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer > (240)-535-6665 (cell) > felisha.lawre...@gmail.com (email) > -- next part -- > An HTML attachment was scrubbed... > URL: > <http://mail.python.org/pipermail/tutor/attachments/20140904/046d8eee/attachment-0001.html> > > -- > > Message: 2 > Date: Thu, 4 Sep 2014 15:01:50 -0400 > From: Joel Goldstick > Cc: "tutor@python.org" > Subject: Re: [Tutor] New to Python..Need help > Message-ID: > > Content-Type: text/plain; charset=UTF-8 > > On Thu, Sep 4, 2014 at 8:49 AM, Felisha Lawrence > wrote: >> Hello, >> I have a question regarding strings in python. I have a directory on my >> MacBook Bro of about 13 files. I need to alter the file endings in that >> directory. The files are on the order of >> 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I >> need to remove the characters after the 'v' and replace with v20. All of the >> endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these >> characters to be the same (i.e. v20). I would like to know which modules are >> best to use, and how to use loops to alter them. Any help you can provide >> would be great. > Check out the documentation for os.walk and os.rename. The first to > collect you filenames, and the second to rename them. > >> Thanks, >> Felisha Lawrence >> >> -- >> Felisha Lawrence >> Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student >> NASA URC/BCCSO Graduate Fellow >> NOAA NCAS Graduate Fellow >> Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer >> (240)-535-6665 (cell) >> felisha.lawre...@gmail.com (email) >> >> ___ >> Tutor maillist - Tutor@python.org >> To unsubscribe or change subscription options: >> https://mail.python.org/mailman/listinfo/tutor > > > > -- > Joel Goldstick > http://joelgoldstick.com > > > -- > > Message: 3 > Date: Thu, 4 Sep 2014 15:05:32 -0400 > From: taserian > To: Felisha Lawrence > Cc: Tutor > Subject: Re: [Tutor] New to Python..Need help > Message-ID: > > Content-Type: text/plain; charset="utf-8" > > Is there anything different between the filenames aside from that suffix > _vXX? If not, then you'll run into problems after the first filename is &g
Re: [Tutor] New to Python..Need help
On 04Sep2014 15:01, Joel Goldstick wrote: On Thu, Sep 4, 2014 at 8:49 AM, Felisha Lawrence wrote: I have a question regarding strings in python. I have a directory on my MacBook Bro of about 13 files. I need to alter the file endings in that directory. The files are on the order of 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I need to remove the characters after the 'v' and replace with v20. All of the endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these characters to be the same (i.e. v20). I would like to know which modules are best to use, and how to use loops to alter them. Any help you can provide would be great. Check out the documentation for os.walk and os.rename. The first to collect you filenames, and the second to rename them. os.listdir will be far easier than os.walk if it is a single flat directory. Cheers, Cameron Simpson Knox's box is a 286. Fox in Socks does hacks and tricks Knox's box is hard to fix. To fix poor Knox's box for kicks. - David Mar , as quoted by John Mackin ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] New to Python..Need help
On Thu, Sep 4, 2014 at 12:05 PM, taserian wrote: > Is there anything different between the filenames aside from that suffix > _vXX? If not, then you'll run into problems after the first filename is > changed; further attempts won't allow the change, since there's already a > file with that same name. Ah. Nice catch! Yeah, that's a potential problem with the problem statement. Felisha, please clarify this point, because it's a big one. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] New to Python..Need help
> I have a question regarding strings in python. I have a directory on my > MacBook Bro of about 13 files. I need to alter the file endings in that > directory. The files are on the order of > 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I > need to remove the characters after the 'v' and replace with v20. All of the > endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these > characters to be the same (i.e. v20). I would like to know which modules are > best to use, and how to use loops to alter them. Any help you can provide > would be great. Hi Felisha, Do you have any prior programming experience? Your subject line suggests that you are new to Python. Are you familiar with any other programming? Give us more details, and we may be able to provide more appropriate advice. In lack of background information, we will assume for the moment that you have some basic programming skills, and will point to documentation where appropriate. We can point to: https://docs.python.org/2/tutorial/ to get a quick-and-dirty introduction to the language. For the operations you'll be doing, you probably want: 1. Some way to collect the set of file names. The glob module might be appropriate: https://docs.python.org/2/library/glob.html 2. Basic string manipulation skills to map the string: "swp.113006004000_KLWX_0.0.5_PPI_v2" to its replacement string: "swp.113006004000_KLWX_0.0.5_PPI_v20" For this particular pattern matching and string replacement, it might be enough to find the rightmost index for the substring "_v" using a string's rfind() method: https://docs.python.org/2/library/stdtypes.html#str.rfind string slicing (https://docs.python.org/2/tutorial/introduction.html#strings) to chop off the tail, and then a string append to put the replacement "_v20" at the end. For anything more sophisticated, you might want to investigate regular expressions. https://docs.python.org/2/howto/regex.html 3. Functions to interact with the operating system, to tell the operating system to rename a file from the old name to its replacement. Possibly os.rename(): https://docs.python.org/2/library/os.html#os.rename Please feel free to ask more questions. Good luck! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] New to Python..Need help
On 04/09/14 13:49, Felisha Lawrence wrote: 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I need to remove the characters after the 'v' and replace with v20. All of the endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these characters to be the same (i.e. v20). How else will you differentiate them if the files are all the same? Do you need to add a sequence number or do you really want to concateate the files into one big file? I would like to know which modules are best to use, and how to use loops to alter them. You can use os.listdir to get all the filenames in a single folder You can use glob.glob to get a subset of the files (using * and ? as wildvards) You can use os.walk to get all the files/folders from a directry tree Once you have the list of files you can use a for loop to access each name. You can the use string.replace() to make simple changes re.sub() to replace regular expressions Or you could use string slicing to replace certain characters based on position, wjhich might work well for your case. HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] New to Python..Need help
Is there anything different between the filenames aside from that suffix _vXX? If not, then you'll run into problems after the first filename is changed; further attempts won't allow the change, since there's already a file with that same name. AR On Thu, Sep 4, 2014 at 8:49 AM, Felisha Lawrence wrote: > Hello, > I have a question regarding strings in python. I have a directory on my > MacBook Bro of about 13 files. I need to alter the file endings in > that directory. The files are on the order of > 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. > I need to remove the characters after the 'v' and replace with v20. All of > the endings of the files are sequential _v2, _v3,_v4, _v5. I need all of > these characters to be the same (i.e. v20). I would like to know which > modules are best to use, and how to use loops to alter them. Any help you > can provide would be great. > > > Thanks, > Felisha Lawrence > > -- > Felisha Lawrence > Howard University Program for Atmospheric Sciences(HUPAS), Graduate > Student > NASA URC/BCCSO Graduate Fellow > NOAA NCAS Graduate Fellow > Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer > (240)-535-6665 (cell) > felisha.lawre...@gmail.com (email) > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > > ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] New to Python..Need help
On Thu, Sep 4, 2014 at 8:49 AM, Felisha Lawrence wrote: > Hello, > I have a question regarding strings in python. I have a directory on my > MacBook Bro of about 13 files. I need to alter the file endings in that > directory. The files are on the order of > 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I > need to remove the characters after the 'v' and replace with v20. All of the > endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these > characters to be the same (i.e. v20). I would like to know which modules are > best to use, and how to use loops to alter them. Any help you can provide > would be great. > > Check out the documentation for os.walk and os.rename. The first to collect you filenames, and the second to rename them. > Thanks, > Felisha Lawrence > > -- > Felisha Lawrence > Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student > NASA URC/BCCSO Graduate Fellow > NOAA NCAS Graduate Fellow > Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer > (240)-535-6665 (cell) > felisha.lawre...@gmail.com (email) > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick http://joelgoldstick.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] New to Python..Need help
Hello, I have a question regarding strings in python. I have a directory on my MacBook Bro of about 13 files. I need to alter the file endings in that directory. The files are on the order of 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I need to remove the characters after the 'v' and replace with v20. All of the endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these characters to be the same (i.e. v20). I would like to know which modules are best to use, and how to use loops to alter them. Any help you can provide would be great. Thanks, Felisha Lawrence -- Felisha Lawrence Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student NASA URC/BCCSO Graduate Fellow NOAA NCAS Graduate Fellow Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer (240)-535-6665 (cell) felisha.lawre...@gmail.com (email) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor