On 06Jul2014 23:03, mrwhackad...@gmail.com wrote:
I need to know how to save my code and save as programs because I write code
Please help and thank you for your time.
Please tell a bit more about your work environment (editors, IDEs, computer OS,
etc).
The basic answer to your question is t
On Mon, 07 Jul 2014 11:00:59 +1000, Ben Finney wrote:
> The makefile syntax is one of the excellent examples of why it's a
> terrible idea to use tab characters in source code. It's also an
> excellent example of how a poor design decision (a line beginning with
> U+0020 SPACE is semantically diff
writes:
> I need to know how to save my code and save as programs because I
> write code and I run it but then I cant save it for later.
You can write Python code using any text editor.
You will do well to use a text editor which is deliberately designed for
programming and other related editin
Steven D'Aprano wrote:
Are there any circumstances where merely *opening* a file (before reading
it) can raise EOFError?
I don't think so. As far as I know, the only built-in
thing that raises EOFError is input() (and raw_input()
in Py2).
--
Greg
--
https://mail.python.org/mailman/listinfo/py
Hi, I’ve been looking forever for this and I cant get it.
I need to know how to save my code and save as programs because I write code
and I run it but then I cant save it for later.
Please help and thank you for your time.--
https://mail.python.org/mailman/listinfo/python-list
Are there any circumstances where merely *opening* a file (before reading
it) can raise EOFError?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Jul 7, 2014 at 12:28 PM, Steven D'Aprano
wrote:
> The story of makefiles is a warning of the dark side to "release early,
> release often", and the dangers of using alpha software in production:
>
> [quote]
> Why the tab in column 1? Yacc was new, Lex was brand new. I hadn't tried
> either
On Mon, Jul 7, 2014 at 10:52 AM, Roy Smith wrote:
> In article ,
> Chris Angelico wrote:
>
>> But the important thing is that you log.
>
> I 'spose. Let's see. Yesterday we generated 133 GB of log files. And
> Sunday is a slow day :-)
Heh, that's a bit bigger in scale than most of what I wor
On Mon, Jul 7, 2014 at 10:53 AM, Ben Finney wrote:
> There are two common cases where ‘help(foo)’ is unable to help:
>
> * If ‘foo’ is a function written without using keyword-only args, but
> needing to have a bunch of keyword arguments, the signature will often
> be the uninformative ‘foo(*a
On Mon, 07 Jul 2014 11:00:59 +1000, Ben Finney wrote:
> The makefile syntax is one of the excellent examples of why it's a
> terrible idea to use tab characters in source code.
Hmmm... I'm not sure that conclusion follows. I think that makefile
syntax is an example of why it is a terrible idea t
On 06Jul2014 15:15, Roy Smith wrote:
In article ,
Mark Lawrence wrote:
In the 21st century real programmers are using the logging module so
they don't have to mess around.
The problem with the logging module is you can configure it to do pretty
much anything, which is another way of saying i
Thank you CA
learn so much from your words
--
https://mail.python.org/mailman/listinfo/python-list
Dan Stromberg writes:
> But I finally acknowledged that some very smart people don't
> understand tabs, or don't want to learn how to use them.
One day, you may reach the further realisation that those same very
smart people *do* understand tabs, and *do* know how to use them — and
nevertheless
In article ,
Chris Angelico wrote:
> But the important thing is that you log.
I 'spose. Let's see. Yesterday we generated 133 GB of log files. And
Sunday is a slow day :-)
> Have you ever had a bug where someone else finds it and then doesn't
> give you full repro steps?
Are there people
Shiyao Ma writes:
> My normal workflow is use ipython, obj? or obj?? for quick look up or
> use docs.python.org for a detailed read.
I don't use IPython. I'm glad it exists for those who want it.
I frequently use Python on hosts not entirely under my control, where I
don't have authority to ins
The reason I did not use \d\d* or \d+ or ^\d+$ or any number of
more-correct things was because the OP was new to regexps.
-- Devin
On Sun, Jul 6, 2014 at 3:49 PM, MRAB wrote:
> On 2014-07-06 18:41, Albert-Jan Roskam wrote:
>>
>>
>>
>>
>>> In article ,
>>> Rick Johnson wrote:
>>>
As an asi
On Mon, Jul 7, 2014 at 5:15 AM, Roy Smith wrote:
> In article ,
> Mark Lawrence wrote:
>
>> On 06/07/2014 19:48, Rick Johnson wrote:
>> >
>> > *Real* programmers possess keen detective that can root out
>> > bugs with nothing more than a few well placed print
>> > statements and some good old fa
On 2014-07-06 18:41, Albert-Jan Roskam wrote:
In article ,
Rick Johnson wrote:
As an aside i prefer to only utilize a "character set" when
nothing else will suffice. And in this case r"[0-9][0-9]*"
can be expressed just as correctly (and less noisy IMHO) as
r"\d\d*".
Even better, r"\d+"
On Mon, Jul 7, 2014 at 1:41 AM, Rick Johnson
wrote:
> Well Steven all i can hope is that one day you and i will be
> working on a project together, and you will ask me for a
> "touch", and when i return with a petrol soaked rag burning
> on the end of twig and proceed to light your hair on fire,
>
>In article ,
> Rick Johnson wrote:
>
>> As an aside i prefer to only utilize a "character set" when
>> nothing else will suffice. And in this case r"[0-9][0-9]*"
>> can be expressed just as correctly (and less noisy IMHO) as
>> r"\d\d*".
>
>Even better, r"\d+"
I tend tot do that too, even th
On Sunday, July 6, 2014 4:32:14 PM UTC-4, Larry Hudson wrote:
> On 07/06/2014 08:03 AM, rxjw...@gmail.com wrote:
>
>
>
> > Thanks. I do not want to waste everyone's time. For a jump start, there are
>
> > small errors making me frustrating. Your help does help me, confirm the
> > usage
>
>
On 07/06/2014 08:03 AM, rxjw...@gmail.com wrote:
Thanks. I do not want to waste everyone's time. For a jump start, there are
small errors making me frustrating. Your help does help me, confirm the usage
etc. After a basic familiarity, I do not want to post more. I use cygwin Python,
I type hel
On 7/6/14, 3:04 PM, William Ray Wing wrote:
Furthermore, I don’t know about Windows, but on many UNIX-like OSs,
the file system preserves the time the file was last accessed. If the
goal is truly to leave no traces of the fact that the a group of files
was backed up, this pretty well would be a
On Sunday, July 6, 2014 1:14:38 PM UTC-5, wxjm...@gmail.com wrote:
> Le dimanche 6 juillet 2014 18:53:34 UTC+2, Rick Johnson a écrit :
> [...]
>
> > Seems like she'd better do the decoding before printing
> No
>
> > or am i wrong again?
> Yes
>
> >>> s = 'abc需'
> >>> sys.stdout.encoding
> ''
>
On Sun, Jul 6, 2014 at 12:57 PM, wrote:
> I write the following code:
>
> ...
> import re
>
> line = "abcdb"
>
> matchObj = re.match( 'a[bcd]*b', line)
>
> if matchObj:
>print "matchObj.group() : ", matchObj.group()
>print "matchObj.group(0) : ", matchObj.group()
>print "matchObj.
In article ,
Dan Stromberg wrote:
> On Thu, Jul 3, 2014 at 10:31 AM, Tobiah wrote:
> > Coworker takes PEP8 as gospel and uses 4 spaces
> > to indent. I prefer tabs.
>
> I recently converted from tabs to spaces. I probably still have some
> code that uses tabs, but most of my personal stuff h
On Sun, Jul 6, 2014 at 1:25 PM, Dan Stromberg wrote:
> I like tabs. Tabs work better for me than spaces, because I know how
> to use them. Also, some "make" tools insist on tabs.
Those tools are just as broken as the ones that only work with spaces.
Fortunately, I can't even remember the last t
On Thu, Jul 3, 2014 at 10:31 AM, Tobiah wrote:
> Coworker takes PEP8 as gospel and uses 4 spaces
> to indent. I prefer tabs.
I recently converted from tabs to spaces. I probably still have some
code that uses tabs, but most of my personal stuff has been converted.
I like tabs. Tabs work bette
In article ,
Mark Lawrence wrote:
> On 06/07/2014 19:48, Rick Johnson wrote:
> >
> > *Real* programmers possess keen detective that can root out
> > bugs with nothing more than a few well placed print
> > statements and some good old fashioned "eyeball analysis".
> >
>
> In the 21st century rea
On 2014-07-06 19:57, rxjw...@gmail.com wrote:
Hi,
On Python website, it says that the following match can reach 'abcb' in 6 steps:
.
A step-by-step example will make this more obvious. Let's consider the
expression
a[bcd]*b. This matches the letter 'a', zero or more letters from the
On 2014-07-06 19:26, rxjw...@gmail.com wrote:
Hi,
I cannot get the difference between matchObj.group() and matchObj.group(0),
Although there definitions are obvious different. And group() mentions 'tuple'.
tuple means all the elements in line object?
Match Object Methods
Description
group(n
On Jul 6, 2014, at 9:21 AM, Richard Damon wrote:
> On 5/21/14, 12:42 PM, Nagy László Zsolt wrote:
>> I need to create an application for Windows 7 that runs from a flash
>> drive. This program would be used to create remote backups of the
>> pendrive. The pendrive contains sensitive data, so whe
On 06/07/2014 19:48, Rick Johnson wrote:
*Real* programmers possess keen detective that can root out
bugs with nothing more than a few well placed print
statements and some good old fashioned "eyeball analysis".
In the 21st century real programmers are using the logging module so
they don't
Hi,
On Python website, it says that the following match can reach 'abcb' in 6 steps:
.
A step-by-step example will make this more obvious. Let's consider the
expression
a[bcd]*b. This matches the letter 'a', zero or more letters from the class
[bcd],
and finally ends with a 'b'. Now
In article <53b98cf2$0$29985$c3e8da3$54964...@news.astraweb.com>,
Steven D'Aprano wrote:
> I have a monkey-patched version of dir() which takes a second
> argument, a glob, to filter the list of names returned:
Neat idea, but globs are for wimps. All the cool kids are using
regexes. See tha
On Sunday, July 6, 2014 11:36:23 AM UTC-5, Shiyao Ma wrote:
> I often heard people mention use help(ob) as a way of
> documentation look up. Personally I seldom/never do that.
> My normal workflow is use ipython, obj? or obj?? for quick
> look up or use docs.python.org for a detailed read. Do you
>
Hi,
I cannot get the difference between matchObj.group() and matchObj.group(0),
Although there definitions are obvious different. And group() mentions 'tuple'.
tuple means all the elements in line object?
Match Object Methods
Description
group(num=0) This method returns entire match (or speci
On 06/07/2014 16:03, rxjw...@gmail.com wrote:
Thanks. I do not want to waste everyone's time. For a jump start, there are
small errors making me frustrating. Your help does help me, confirm the usage
etc. After a basic familiarity, I do not want to post more. I use cygwin Python,
I type help of
On 2014-07-06 17:52, Steven D'Aprano wrote:
> I have a monkey-patched version of dir() which takes a second
> argument, a glob, to filter the list of names returned:
>
> py> len(dir(os)) # Too much!
> 312
> py> dir(os, 'env')
> ['_putenv', '_unsetenv', 'environ', 'environb', 'getenv',
> 'getenvb'
On Sunday, July 6, 2014 12:38:23 PM UTC-5, Rick Johnson wrote:
> r'\s*#[^\n]'
Well, there i go not testing again!
r'\s*#[^\n]*'
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 07 Jul 2014 00:36:23 +0800, Shiyao Ma wrote:
> Hi Pythonistas
>
> I often heard people mention use help(ob) as a way of documentation look
> up. Personally I seldom/never do that. My normal workflow is use
> ipython, obj? or obj?? for quick look up or use docs.python.org for a
> detailed
On Sunday, July 6, 2014 11:47:38 AM UTC-5, Roy Smith wrote:
> Even better, r"\d+"
> >>> re.search(r'(\d\d*)', '111aaa222').groups()
> ('111',)
> >>> re.search(r'(\d+)', '111aaa222').groups()
> ('111',)
Yes, good catch! I had failed to reduce your original
pattern down to it's most fundamental aspe
On Sunday, July 6, 2014 11:14:26 AM UTC-5, Terry Reedy wrote:
> On 7/6/2014 10:52 AM, Rick Johnson wrote:
> > So the direct reason for failure is due to the fact that the
> > "print()" function ONLY handles strings, not list objects.
> >>> print(object())
>
> >>> print(['abc', 'cdf'])
> ['abc',
In article ,
Rick Johnson wrote:
> As an aside i prefer to only utilize a "character set" when
> nothing else will suffice. And in this case r"[0-9][0-9]*"
> can be expressed just as correctly (and less noisy IMHO) as
> r"\d\d*".
Even better, r"\d+"
>>> re.search(r'(\d\d*)', '111aaa222').grou
Hi Pythonistas
I often heard people mention use help(ob) as a way of documentation
look up. Personally I seldom/never do that. My normal workflow is use
ipython, obj? or obj?? for quick look up or use docs.python.org for a
detailed read.
Do you use `help`? How does it integrate into your workflo
[CONTINUED FROM LAST REPLY...]
Likewise if your intent is to filter out any match strings
which contain non-digits, then define the start and stop
points of the pattern:
# Match only if all are digits
>>> re.match(r'\d\d*$', '111aaa222') # fails
# Match only if all are digits and,
# allow leadin
On Sunday, July 6, 2014 10:50:13 AM UTC-5, Devin Jeanpierre wrote:
> In related news, the regexp I gave for numbers will match "1a".
Well of course it matched, because your pattern defines "one
or more consecutive digits". So it will match the "1" of
"1a" and the "11" of "11a" likewise.
As an asi
On 7/6/2014 10:52 AM, Rick Johnson wrote:
So the direct reason for failure is due to the fact that the
"print()" function ONLY handles strings, not list objects.
>>> print(object())
>>> print(['abc', 'cdf'])
['abc', 'cdf']
Since the original poster did not copy the traceback from the print
On Sunday, July 6, 2014 5:43:55 PM UTC+5:30, rxj...@gmail.com wrote:
> Hi,
> I type the following sample codes on Python, but it echoes differently.
> Regular expressions are compiled into pattern objects, which have methods for
> various operations such as searching for pattern matches or perfor
In article <6fd77d6a-3487-474b-bb96-8da6ab800...@googlegroups.com>,
Rick Johnson wrote:
> On Sunday, July 6, 2014 9:34:44 AM UTC-5, Roy Smith wrote:
>
> > * You can print dict(foo), which just prints out the attributes the
> > object has.
>
> Looks like a typo there.
>
> I think you probabl
On Sunday, July 6, 2014 10:03:48 AM UTC-5, rxj...@gmail.com wrote:
> Thanks. I do not want to waste everyone's time.
Oh NOW you tell us! I could be ranting about flashlights,
but here i am wasting time with you again!
> For a jump start, there are small errors making me
> frustrating. Your help
In related news, the regexp I gave for numbers will match "1a".
-- Devin
On Sun, Jul 6, 2014 at 8:32 AM, MRAB wrote:
> On 2014-07-06 13:09, Devin Jeanpierre wrote:
>>
>> On Sun, Jul 6, 2014 at 4:51 AM, wrote:
>>>
>>> Hi,
>>>
>>> I just begin to learn Python. I do not see the usefulness of '*'
On Sunday, July 6, 2014 9:34:44 AM UTC-5, Roy Smith wrote:
> * You can print dict(foo), which just prints out the attributes the
> object has.
Looks like a typo there.
I think you probably meant to say "dir(foo)"
INTERACTIVE SESSIO
rxjw...@gmail.com wrote:
> I use cygwin Python,
> I type help of an object 'result'. It does show up the help content, but
> it never quits the help afterwards. It is annoying, and time wasting.
To quit help try hitting the 'q' key.
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, July 5, 2014 5:15:32 AM UTC-5, Steven D'Aprano wrote:
> (By the way, outside of the USA, flashlights in the rest
> of the English- speaking world are usually called
> "torches", so called because, like the old-fashioned
> burning torch, they provide light.)
Well Steven all i can hope
On 2014-07-06 13:09, Devin Jeanpierre wrote:
On Sun, Jul 6, 2014 at 4:51 AM, wrote:
Hi,
I just begin to learn Python. I do not see the usefulness of '*' in its
description below:
The first metacharacter for repeating things that we'll look at is *. * doesn't
match the literal character *;
On Sunday, July 6, 2014 10:18:53 AM UTC-4, Rick Johnson wrote:
> On Sunday, July 6, 2014 8:38:41 AM UTC-5, rxj...@gmail.com wrote:
>
> > When I get match result:
>
> > py>pattern='abcd'
>
> > py>prog = re.compile(pattern)
>
> > py>string='abcd'
>
> > py>result = prog.match(string)
>
> > py>re
On Sunday, July 6, 2014 4:05:10 AM UTC-5, gintare wrote:
> The correct code:
> f=open(,'r', encoding='utf-8')
> linef=f.readlines()
> print(repr(linef))
Yes but do you understand why? And even if you DO understand
why, you should explain the details because the neophytes
are always watching!
On 06/07/2014 15:34, Roy Smith wrote:
* You can print foo itself, to find out its value, but this can get
tricky, since sometimes objects print themselves in confusing ways.
Printing repr(foo) will usually get you more detail.
For the OP the pretty print module is usually better than plain ol
On Mon, Jul 7, 2014 at 12:34 AM, Roy Smith wrote:
> * You can print type(foo), to find out exactly what it is (useful when
> even printing repr() doesn't explain what's going on).
And very VERY occasionally, print(id(type(foo))) comes in handy,
because two types might look the same, but an isinst
In article <21e704ee-648b-423d-8682-11cb310a3...@googlegroups.com>,
Rick Johnson wrote:
> On Sunday, July 6, 2014 8:38:41 AM UTC-5, rxj...@gmail.com wrote:
> > When I get match result:
> > py>pattern='abcd'
> > py>prog = re.compile(pattern)
> > py>string='abcd'
> > py>result = prog.match(string)
On 06/07/2014 14:38, rxjw...@gmail.com wrote:
On Sunday, July 6, 2014 8:54:42 AM UTC-4, Tim Chase wrote:
On 2014-07-06 05:13, rxjw...@gmail.com wrote:
What I get on Python console:
$ python
Python 2.7.5 (default, Oct 2 2013, 22:34:09)
[GCC 4.8.1] on cygwin
Type "help", "copyri
On Sunday, July 6, 2014 8:38:41 AM UTC-5, rxj...@gmail.com wrote:
> When I get match result:
> py>pattern='abcd'
> py>prog = re.compile(pattern)
> py>string='abcd'
> py>result = prog.match(string)
> py>result
> <_sre.SRE_Match object at 0x6eda5e0>
> py>result.group(0)
> 'abcd'
>
> It looks li
On Sunday, July 6, 2014 8:54:42 AM UTC-4, Tim Chase wrote:
> On 2014-07-06 05:13, rxjw...@gmail.com wrote:
>
> > What I get on Python console:
>
> >
>
> > $ python
>
> > Python 2.7.5 (default, Oct 2 2013, 22:34:09)
>
> > [GCC 4.8.1] on cygwin
>
> > Type "help", "copyright", "credits" or "li
On 5/21/14, 12:42 PM, Nagy László Zsolt wrote:
I need to create an application for Windows 7 that runs from a flash
drive. This program would be used to create remote backups of the
pendrive. The pendrive contains sensitive data, so when I plug in the
pendrive and run the program to make a backup
Hey everyone,
We are conducting a webinar this Wednesday about How to Manage Your Python Open
Source. the session will be mainly about challenge of managing open-source
components that are embedded in your Python projects.
If you are interested please register in this form:
https://attendee.gotow
gintare Wrote in message:
> The answer is on
> page:https://docs.python.org/3.3/howto/unicode.html#reading-and-writing-unicode-data
>
> The correct code:
> f=open('C:\Python33\Scripts\lang\langu\svtxt.txt','r', encoding='utf-8')
> linef=f.readlines()
> print(repr(linef))
>
But naturally the pa
On 2014-07-06 05:13, rxjw...@gmail.com wrote:
> What I get on Python console:
>
> $ python
> Python 2.7.5 (default, Oct 2 2013, 22:34:09)
> [GCC 4.8.1] on cygwin
> Type "help", "copyright", "credits" or "license" for more
> information.
> >>> import re
> >>> p = re.compile('ab*')
> File "", lin
Hi,
I type the following sample codes on Python, but it echoes differently.
Regular expressions are compiled into pattern objects, which have methods for
various operations such as searching for pattern matches or performing string
substitutions.
>>>
>>> import re
>>> p = re.compile('ab*')
>>> p
On Sun, Jul 6, 2014 at 4:51 AM, wrote:
> Hi,
>
> I just begin to learn Python. I do not see the usefulness of '*' in its
> description below:
>
>
>
>
> The first metacharacter for repeating things that we'll look at is *. *
> doesn't
> match the literal character *; instead, it specifies that th
Hi,
I just begin to learn Python. I do not see the usefulness of '*' in its
description below:
The first metacharacter for repeating things that we'll look at is *. * doesn't
match the literal character *; instead, it specifies that the previous character
can be matched zero or more times, ins
The answer is on
page:https://docs.python.org/3.3/howto/unicode.html#reading-and-writing-unicode-data
The correct code:
f=open('C:\Python33\Scripts\lang\langu\svtxt.txt','r', encoding='utf-8')
linef=f.readlines()
print(repr(linef))
--
https://mail.python.org/mailman/listinfo/python-list
I run python33 scrupt SVtxt.py from Windows command line
I want to print out the file contents to stdout.
File contents: "Vi kan inte längre underordna den vinster..."
Python script sentences i have tries to use:
f=open('C:\Python33\Scripts\lang\langu\svtxt.txt','r')
linef=f.readlines()
f.close(
73 matches
Mail list logo