Re: [Tutor] Is there a library which has this object?

2016-04-28 Thread Alan Gauld via Tutor
On 28/04/16 19:08, Yeh wrote: > I just solved my first question by using numpy, as below: You need to post in plain text otherwise the mail system mangles your code, as you can see. > import timeimport numpy as np > start = input("please input the value of start: ")end = input("please input >

Re: [Tutor] Is there a library which has this object?

2016-04-28 Thread Yeh
Thank you! > You probably want to look at the itertools module. > > There you can find among others the count() generator function. > Others of possible interest include cycle() and repeat() Yeah, I'm going to check them now.and I just solved my first question by using numpy, as below: import

Re: [Tutor] Detect the folder of a file

2016-04-28 Thread Alan Gauld via Tutor
On 28/04/16 11:11, Steven D'Aprano wrote: > You know, some day I must learn why people use virtual environments. Me too :-) My co-author included a section in one of her chapters of our recent book, and I duly played with them while reviewing that chapter. But at the end I just deleted it all

Re: [Tutor] Is there a library which has this object?

2016-04-28 Thread Alan Gauld via Tutor
On 28/04/16 14:53, Yeh wrote: > Hi, > Is there a library which can return some numbers continuously? You probably want to look at the itertools module. There you can find among others the count() generator function. Others of possible interest include cycle() and repeat() -- Alan G Author of

[Tutor] Is there a library which has this object?

2016-04-28 Thread Yeh
Hi, Is there a library which can return some numbers continuously? It will be better to be found in the standard library. If there is not, I'm going to write the function. But, I have no ideas about it yet. (I'm absolutely a beginner.) I want to have a function which may has three arguments

Re: [Tutor] Detect the folder of a file

2016-04-28 Thread Joel Goldstick
On Thu, Apr 28, 2016 at 9:24 AM, Oscar Benjamin wrote: > On 28 April 2016 at 11:11, Steven D'Aprano wrote: >> On Thu, Apr 28, 2016 at 09:57:19AM +0100, Oscar Benjamin wrote: >> >> You know, some day I must learn why people use virtual

Re: [Tutor] Detect the folder of a file

2016-04-28 Thread Oscar Benjamin
On 28 April 2016 at 11:11, Steven D'Aprano wrote: > On Thu, Apr 28, 2016 at 09:57:19AM +0100, Oscar Benjamin wrote: > >> You can write some code to test if a particular path represents the >> base directory of a virtual environment but I expect it would probably >> be

Re: [Tutor] Detect the folder of a file

2016-04-28 Thread Steven D'Aprano
On Thu, Apr 28, 2016 at 09:57:19AM +0100, Oscar Benjamin wrote: > You can write some code to test if a particular path represents the > base directory of a virtual environment but I expect it would probably > be fragile. Without knowing why you want to do this I suggest that you > might want to

Re: [Tutor] Detect the folder of a file

2016-04-28 Thread Peter Otten
Oscar Benjamin wrote: > On 28 April 2016 at 02:02, Kanika Murarka wrote: >> Thanks Oliver and Alex, I didnt know about these commands :D >> >> Oliver, >> When i typed >> print filename >> print sys.executable >> print

Re: [Tutor] Detect the folder of a file

2016-04-28 Thread Oscar Benjamin
On 28 April 2016 at 02:02, Kanika Murarka wrote: > Thanks Oliver and Alex, I didnt know about these commands :D > > Oliver, > When i typed > print filename > print sys.executable > print sys.prefix > print

Re: [Tutor] Detect the folder of a file

2016-04-28 Thread Kanika Murarka
Thanks Oliver and Alex, I didnt know about these commands :D Oliver, When i typed print filename print sys.executable print sys.prefix print os.path.split(sys.prefix)[-1] my output was