Robert Latest wrote:
> Paul Bryan wrote:
>> Adding to this, there should be no reason now in recent versions of
>> Python to ever use line continuation. Black goes so far as to state
>> "backslashes are bad and should never be used":
>>
>> https://black.readthedocs.io/en/stable/the_black_code_style
Paul Bryan wrote:
> Adding to this, there should be no reason now in recent versions of
> Python to ever use line continuation. Black goes so far as to state
> "backslashes are bad and should never be used":
>
> https://black.readthedocs.io/en/stable/the_black_code_style/
future_style.html#using-
Edmondo Giovannozzi wrote:
> Il giorno mercoledì 22 febbraio 2023 alle 09:50:14 UTC+1 Robert Latest ha
> scritto:
>> I found myself building a complicated logical condition with many ands and
>> ors which I made more manageable by putting the various terms on individual
>> lines and breaking them w
On 25/02/2023 10.04, Mark Bourne wrote:
Personally, I don't particularly like the way you have to put multiline
strings on the far left (rather than aligned with the rest of the scope)
to avoid getting spaces at the beginning of each line. I find it makes
it more difficult to see where the sco
Mark Bourne schreef op 24/02/2023 om 22:04:
Personally, I don't particularly like the way you have to put multiline
strings on the far left (rather than aligned with the rest of the scope)
to avoid getting spaces at the beginning of each line. I find it makes
it more difficult to see where the s
Open spam\n"
HelpText += " Shift + Left click: Cook spam\n"
...
Or perhaps just dumping the multi-line text into a file beforehand and reading
that into a string!
def someFunc():
The backslash is not looking like such a bad idea! LOL!
-Original Message-
From
On 24/02/2023 12.45, Weatherby,Gerard wrote:
NB my PyCharm-settings grumble whenever I create an identifier which
is
only used once (and perhaps, soon after it was established). I
understand the (space) optimisation, but prefer to trade that for
'readability'.
It isn't "space". Got an example
ld react if you used:
self.LEGAL_AGE_US = 21
-Original Message-
From: Python-list On
Behalf Of dn via Python-list
Sent: Thursday, February 23, 2023 9:01 PM
To: [email protected]
Subject: Re: Line continuation and comments
On 24/02/2023 12.45, Weatherby,Gerard wrote:
> “
> NB my PyCharm-s
On 24/02/2023 12.45, Weatherby,Gerard wrote:
“
NB my PyCharm-settings grumble whenever I create an identifier which is
only used once (and perhaps, soon after it was established). I
understand the (space) optimisation, but prefer to trade that for
'readability'.
“
I haven’t seen that one. What I
dult( self )->bool:
LEGAL_AGE_US = 21
return LEGAL_AGE
It doesn’t like LEGAL_AGE_US being all caps if declared in a function.
From: Python-list on
behalf of dn via Python-list
Date: Thursday, February 23, 2023 at 5:46 PM
To: [email protected]
Subject: Re: Line continuation
On 22/02/2023 21.49, Robert Latest via Python-list wrote:
I found myself building a complicated logical condition with many ands and ors
which I made more manageable by putting the various terms on individual lines
and breaking them with the "\" line continuation character. In this context it
wou
ps just dumping the multi-line text into a file beforehand and reading
that into a string!
def someFunc():
The backslash is not looking like such a bad idea! LOL!
-Original Message-
From: Python-list On
Behalf Of Rob Cliffe via Python-list
Sent: Wednesday, February 22, 2023 2:08 PM
To:
On 22/02/2023 15:23, Paul Bryan wrote:
Adding to this, there should be no reason now in recent versions of
Python to ever use line continuation. Black goes so far as to state
"backslashes are bad and should never be used":
https://black.readthedocs.io/en/stable/the_black_code_style/future_styl
On 22Feb2023 11:27, Thomas Passin wrote:
On 2/22/2023 10:02 AM, Weatherby,Gerard wrote:
That’s a neat tip. End of line comments work, too
x = (3 > 4 #never
and 7 == 7 # hopefully
or datetime.datetime.now().day > 15 # sometimes
)
print(x)
I find myself doing this more and mor
vannozzi
Date: Wednesday, February 22, 2023 at 9:40 AM
To: [email protected]
Subject: Re: Line continuation and comments
*** Attention: This is an external email. Use caution responding, opening
attachments or clicking on links. ***
Il giorno mercoledì 22 febbraio 2023 alle 09:50:14 UTC+1
on.org
Subject: Re: Line continuation and comments
*** Attention: This is an external email. Use caution responding, opening
attachments or clicking on links. ***
Il giorno mercoledì 22 febbraio 2023 alle 09:50:14 UTC+1 Robert Latest ha
scritto:
> I found myself building a complicated logical
Adding to this, there should be no reason now in recent versions of
Python to ever use line continuation. Black goes so far as to state
"backslashes are bad and should never be used":
https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#using-backslashes-for-with-statement
Il giorno mercoledì 22 febbraio 2023 alle 09:50:14 UTC+1 Robert Latest ha
scritto:
> I found myself building a complicated logical condition with many ands and
> ors
> which I made more manageable by putting the various terms on individual lines
> and breaking them with the "\" line continuatio
On 9/29/17, Rob Gaddi wrote:
> On 09/29/2017 10:54 AM, Stefan Ram wrote:
>>In some languages, printing »'\n'«, the Unicode code point 10,
>>will have the effect of printing a line terminator, which might
>>mean that the output device actually receives »\r\n«.
>>
>>The line terminat
On 09/29/2017 10:54 AM, Stefan Ram wrote:
In some languages, printing »'\n'«, the Unicode code point 10,
will have the effect of printing a line terminator, which might
mean that the output device actually receives »\r\n«.
The line terminator ostensibly depends on the operating
sy
On 29 September 2017 at 19:54, Stefan Ram wrote:
> In some languages, printing »'\n'«, the Unicode code point 10,
> will have the effect of printing a line terminator, which might
> mean that the output device actually receives »\r\n«.
>
> The line terminator ostensibly depends on the oper
On Sat, Sep 30, 2017 at 3:54 AM, Stefan Ram wrote:
> In some languages, printing »'\n'«, the Unicode code point 10,
> will have the effect of printing a line terminator, which might
> mean that the output device actually receives »\r\n«.
>
> The line terminator ostensibly depends on the op
On 29/09/17 19:54, Stefan Ram wrote:
> In some languages, printing »'\n'«, the Unicode code point 10,
> will have the effect of printing a line terminator, which might
> mean that the output device actually receives »\r\n«.
>
> The line terminator ostensibly depends on the operating
> sys
- Original Message -
> From: "ltc hotspot"
> To: "[email protected]"
> Sent: Tuesday, 28 July, 2015 10:21:59 PM
> Subject: line error on no. 7
> Hi Everyone,
> I'm writing python code to read a data text file, split the file into
> a list of words using the split(function) and to pr
On 16-06-14 13:09, Chris Angelico wrote:
> On Mon, Jun 16, 2014 at 8:51 PM, Tim Chase
> wrote:
>> On 2014-06-16 20:41, Chris Angelico wrote:
>>> Oops! I made the cardinal error of trying in one and assuming it'd
>>> work in both. Just needs a b prefix on the split string:
>>>
>>> def shell_split(c
On 2014-06-16 13:51, Antoon Pardon wrote:
> >>> shlex.split("ls *.py")
> ['ls', '*.py']
> >>> shlex.split("ls '*.py'")
> ['ls', '*.py']
To accommodate this, I'd probably just clone the shlib.py to my local
project under a new name and then tweak the source to emit whether a
token was quoted or
On 16-06-14 13:01, Peter Otten wrote:
> Antoon Pardon wrote:
>
>> I am looking for an interface that takes a string as argument. The
>> string is to be treated as if it is a command line and transformed into
>> an argv list.
>>
>> "ls file" -> ['ls', 'file']
>> "ls *.py" -> ['ls', 'file1.py', '
On Mon, Jun 16, 2014 at 8:59 PM, Marko Rauhamaa wrote:
> Chris Angelico :
>
>> def shell_split(cmd):
>> return subprocess.check_output("""python -c 'import sys;
>> print("\\0".join(sys.argv[1:]))' """+cmd,shell=True)[:-1].split(b"\0")
>>
>> You'll get back a list of byte strings, in any case.
On 2014-06-16 20:41, Chris Angelico wrote:
> Oops! I made the cardinal error of trying in one and assuming it'd
> work in both. Just needs a b prefix on the split string:
>
> def shell_split(cmd):
> return subprocess.check_output("""python -c 'import sys;
> print("\\0".join(sys.argv[1:]))'
> "
On Mon, Jun 16, 2014 at 8:51 PM, Tim Chase
wrote:
> On 2014-06-16 20:41, Chris Angelico wrote:
>> Oops! I made the cardinal error of trying in one and assuming it'd
>> work in both. Just needs a b prefix on the split string:
>>
>> def shell_split(cmd):
>> return subprocess.check_output("""pyth
Antoon Pardon wrote:
> I am looking for an interface that takes a string as argument. The
> string is to be treated as if it is a command line and transformed into
> an argv list.
>
> "ls file" -> ['ls', 'file']
> "ls *.py" -> ['ls', 'file1.py', 'file2.py', ...]
> "ls '*.py'" -> ['ls', '*.py'
Chris Angelico :
> def shell_split(cmd):
> return subprocess.check_output("""python -c 'import sys;
> print("\\0".join(sys.argv[1:]))' """+cmd,shell=True)[:-1].split(b"\0")
>
> You'll get back a list of byte strings, in any case. Feel free to pass
> them through a decode operation, or to incor
On Mon, Jun 16, 2014 at 8:24 PM, Antoon Pardon
wrote:
> On 16-06-14 12:06, Chris Angelico wrote:
>
>> def shell_split(cmd):
>> return subprocess.check_output("""python -c 'import sys;
>> print("\\0".join(sys.argv[1:]))' """+cmd,shell=True)[:-1].split("\0")
>
> Nice idea, unfortunatly it doesn'
On 16-06-14 12:06, Chris Angelico wrote:
> def shell_split(cmd):
> return subprocess.check_output("""python -c 'import sys;
> print("\\0".join(sys.argv[1:]))' """+cmd,shell=True)[:-1].split("\0")
Nice idea, unfortunatly it doesn't work in python3.3
>>> shell_split("ls *.py")
Traceback (most
On Mon, Jun 16, 2014 at 7:56 PM, Antoon Pardon
wrote:
> I am looking for an interface that takes a string as argument. The
> string is to be treated as if it is a command line and transformed into
> an argv list.
>
> "ls file" -> ['ls', 'file']
> "ls *.py" -> ['ls', 'file1.py', 'file2.py', ...
On Mon, 31 Mar 2014 04:29:15 -0700, Jamie Mitchell wrote:
> I am new to python so apologies for the ignorance with this question.
>
> How would I apply a line of best fit to a plot?
That depends on what software you are using to generate the plot. I see
you have this line of code:
> plt.plot(h
Roy Smith wrote:
> Please tell us more about the environment you're working in. I'm
> guessing from the fact that you're calling plt.plot(), that you've
> already got some add-on modules loaded. Pandas, maybe?
Probably matplotlib.pyplot
--
https://mail.python.org/mailman/listinfo/python-li
None of these are in the standard library but why re-invent the wheel?
Using numpy:
http://docs.scipy.org/doc/numpy/reference/generated/numpy.polyfit.html
scipy:
http://docs.scipy.org/doc/scipy-0.13.0/reference/generated/scipy.stats.linregress.html
statsmodels:
http://statsmodels.sourceforge.net
In article <[email protected]>,
Jamie Mitchell wrote:
> I am new to python so apologies for the ignorance with this question.
>
> How would I apply a line of best fit to a plot?
Python has nothing built-in which does that, but there are plenty of
add-on mod
Den lördagen den 21:e december 2013 kl. 20:56:54 UTC+1 skrev Ned Batchelder:
> On 12/21/13 2:12 PM, [email protected] wrote:
>
> > Den l�rdagen den 21:e december 2013 kl. 20:03:17 UTC+1 skrev Ned
> > Batchelder:
>
> >> On 12/21/13 1:30 PM, [email protected] wrote:
>
> >>
>
>
On 12/21/13 2:12 PM, [email protected] wrote:
Den lördagen den 21:e december 2013 kl. 20:03:17 UTC+1 skrev Ned Batchelder:
On 12/21/13 1:30 PM, [email protected] wrote:
Is there a way to make linebased graphic used in canvas scale correct on any
monitor?
I run in 1920*1
Den lördagen den 21:e december 2013 kl. 20:03:17 UTC+1 skrev Ned Batchelder:
> On 12/21/13 1:30 PM, [email protected] wrote:
>
> > Is there a way to make linebased graphic used in canvas scale correct on
> > any monitor?
>
> >
>
> > I run in 1920*1080 on a Philips TV used as monitor doe
On 12/21/13 1:30 PM, [email protected] wrote:
Is there a way to make linebased graphic used in canvas scale correct on any
monitor?
I run in 1920*1080 on a Philips TV used as monitor does it matter, lines tend
to get longer vertical then horizontal?
Strange is i really do not see it w
Ross Boylan wrote:
>> No [easy] way to go from bytecodes back to AST, but I see no reason
>> why you can't create a new code object with your filename and line
>> numbers and then create a new function using your modified code
>> object.
> Could you elaborate? I don't understand what you are su
Duncan Booth wrote
> Ross Boylan wrote:
>
> > As an extension or alternate, could there be a decorator like
> > @source_line(lineno, filename)
> > for classes and methods that could do the conversion on the fly? I
> > don'
Ross Boylan wrote:
> As an extension or alternate, could there be a decorator like
> @source_line(lineno, filename)
> for classes and methods that could do the conversion on the fly? I
> don't know if there's a way to go from the function (or class) object
> the decorator receives to the AST.
>
On Fri, Nov 04, 2011 at 11:10:58AM -0400, Steven Lehar wrote:
> Is this the right place to propose language extensions?
>
> My Python code keeps expanding rightwards, it is difficult to keep it
> contained within reasonable limits. But the standard line continuation \
> is positively anti-Pythonic
On 11/4/2011 11:10 AM, Steven Lehar wrote:
Is this the right place to propose language extensions?
Yes, especially for beginners not familiar with previous discussions.
My Python code keeps expanding rightwards, it is difficult to keep it
contained within reasonable limits. But the standard l
On Sat, Nov 5, 2011 at 2:53 AM, Steven Lehar wrote:
>
> >
> How's it anti-Pythonic for invisible whitespace differences to be significant?
> A central idea of Python was to replace {curly;braces{and;parentheses;}},
> which are easily overlooked by the programmer, and use WHITESPACE instead,
> so
>
How's it anti-Pythonic for invisible whitespace differences to be
significant?
A central idea of Python was to replace {curly;braces{and;parentheses;}},
which are easily overlooked by the programmer, and use WHITESPACE instead,
something that is clearly visible to the programmer, as the defining
On Sat, Nov 5, 2011 at 2:10 AM, Steven Lehar wrote:
> But the standard line continuation \
> is positively anti-Pythonic because an *invisible* white space between \ and
> [CR] will render it useless.
How's it anti-Pythonic for invisible whitespace differences to be significant?
ChrisA
*grinni
Steven Lehar wrote:
> Is this the right place to propose language extensions?
>
> My Python code keeps expanding rightwards, it is difficult to keep it
> contained within reasonable limits.
You should attack this by breaking large expressions into smaller ones and
factoring out some of your co
On Fri, 21 Jan 2011 07:39:26 -0800, Oltmans wrote:
> Hi Python gurus, hope you're doing well. I've a small problem.
>
> When I run the following code
> ___
names = ['oltmans','abramhovic','\n','sal','lee'] print '| ' + ' |
'.join(names)
>
On 21/01/2011 16:25, Peter Otten wrote:
Oltmans wrote:
Hi Python gurus, hope you're doing well. I've a small problem.
When I run the following code
___
names = ['oltmans','abramhovic','\n','sal','lee']
print '| ' + ' | '.join(names)
| oltmans |
Oltmans wrote:
> Hi Python gurus, hope you're doing well. I've a small problem.
>
> When I run the following code
> ___
names = ['oltmans','abramhovic','\n','sal','lee']
print '| ' + ' | '.join(names)
> | oltmans | abramhovic |
> | sal |
On Wed, 11 Aug 2010 18:49:26 -0700, RG wrote:
> This doesn't explain why "cat | cat" when run interactively outputs
> line-by-line (which it does). STDIN to the first cat is a TTY, but the
> second one isn't.
GNU cat doesn't use stdio, it uses read() and write(), so there isn't any
buffering.
In article ,
Nobody wrote:
> On Wed, 11 Aug 2010 10:32:41 +, Tim Harig wrote:
>
> >>> Usually you either
> >>> need an option on the upstream program to tell it to line
> >>> buffer explicitly
> >>
> >> once cat had an option -u doing exactly that but nowadays
> >> -u seems to be ignored
>
On Wed, 11 Aug 2010 10:32:41 +, Tim Harig wrote:
>>> Usually you either
>>> need an option on the upstream program to tell it to line
>>> buffer explicitly
>>
>> once cat had an option -u doing exactly that but nowadays
>> -u seems to be ignored
>>
>> http://www.opengroup.org/onlinepubs/009695
On 11Aug2010 12:35, Tim Harig wrote:
| > The buffering is a performance choice. Every write requires a context
| > switch from userspace to kernel space, and availability of data in the
| > pipe will wake up a downstream process blocked trying to read.
| > It is far more efficient to do as few suc
In article ,
RG wrote:
> In article ,
> Tim Harig wrote:
>
> > On 2010-08-11, RG wrote:
> > > In article ,
> > > Tim Harig wrote:
> > >
> > >> On 2010-08-11, RG wrote:
> > >> > I'm writing a system in a different language but want to use a Python
> > >> > library. I know of lots of ways
In article ,
Tim Harig wrote:
> On 2010-08-11, RG wrote:
> > In article ,
> > Tim Harig wrote:
> >
> >> On 2010-08-11, RG wrote:
> >> > I'm writing a system in a different language but want to use a Python
> >> > library. I know of lots of ways to do this (embed a Python interpreter,
> >>
On 2010-08-11, RG wrote:
> In article ,
> Tim Harig wrote:
>
>> On 2010-08-11, RG wrote:
>> > I'm writing a system in a different language but want to use a Python
>> > library. I know of lots of ways to do this (embed a Python interpreter,
>> > fire up a python server) but by far the easies
In article ,
Tim Harig wrote:
> On 2010-08-11, RG wrote:
> > I'm writing a system in a different language but want to use a Python
> > library. I know of lots of ways to do this (embed a Python interpreter,
> > fire up a python server) but by far the easiest to implement is to have
> > the
On 2010-08-11, RG wrote:
> I'm writing a system in a different language but want to use a Python
> library. I know of lots of ways to do this (embed a Python interpreter,
> fire up a python server) but by far the easiest to implement is to have
> the main program spawn a Python interpreter and
In article ,
Peter Otten <[email protected]> wrote:
> Grant Edwards wrote:
>
> > On 2010-08-11, Tim Harig wrote:
> >> On 2010-08-11, RG wrote:
> >>> When stdin is not a tty, Python seems to buffer all the input through
> >>> EOF before processing any of it:
> >>>
> >>> [...@mickey:~]$ cat | pyt
In article ,
Cameron Simpson wrote:
> On 11Aug2010 00:11, RG wrote:
> | When stdin is not a tty, Python seems to buffer all the input through
> | EOF before processing any of it:
> |
> | [...@mickey:~]$ cat | python
> | print 123
> | print 456
> | 123
> | 456
> |
> | Is there a way to get P
On 2010-08-11, Peter Otten <[email protected]> wrote:
> Grant Edwards wrote:
>>> If you want to handle stdin a single line at a time from inside of
>>> your program, you can access it using sys.stdin.readline().
>>
>> That doesn't have any effect on stdin buffering.
>
> "for line in stream"-styl
Grant Edwards wrote:
> On 2010-08-11, Tim Harig wrote:
>> On 2010-08-11, RG wrote:
>>> When stdin is not a tty, Python seems to buffer all the input through
>>> EOF before processing any of it:
>>>
>>> [...@mickey:~]$ cat | python
>>> print 123
>>> print 456
>>> 123
>>> 456
>>>
>>> Is there a w
On 2010-08-11, Tim Harig wrote:
> On 2010-08-11, RG wrote:
>> When stdin is not a tty, Python seems to buffer all the input through
>> EOF before processing any of it:
>>
>> [...@mickey:~]$ cat | python
>> print 123
>> print 456
>> 123
>> 456
>>
>> Is there a way to get Python to process input
On 2010-08-11, Cameron Simpson wrote:
> On 11Aug2010 10:32, Tim Harig wrote:
>| On 2010-08-11, Wolfgang Rohdewald wrote:
>| > On Mittwoch 11 August 2010, Cameron Simpson wrote:
>| >> Usually you either
>| >> need an option on the upstream program to tell it to line
>| >> buffer explicitly
>| >
>
On 11Aug2010 10:32, Tim Harig wrote:
| On 2010-08-11, Wolfgang Rohdewald wrote:
| > On Mittwoch 11 August 2010, Cameron Simpson wrote:
| >> Usually you either
| >> need an option on the upstream program to tell it to line
| >> buffer explicitly
| >
| > once cat had an option -u doing exactly that
On 2010-08-11, Wolfgang Rohdewald wrote:
> On Mittwoch 11 August 2010, Cameron Simpson wrote:
>> Usually you either
>> need an option on the upstream program to tell it to line
>> buffer explicitly
>
> once cat had an option -u doing exactly that but nowadays
> -u seems to be ignored
>
> http://ww
On Mittwoch 11 August 2010, Cameron Simpson wrote:
> Usually you either
> need an option on the upstream program to tell it to line
> buffer explicitly
once cat had an option -u doing exactly that but nowadays
-u seems to be ignored
http://www.opengroup.org/onlinepubs/009695399/utilities/cat.html
On 11Aug2010 00:11, RG wrote:
| When stdin is not a tty, Python seems to buffer all the input through
| EOF before processing any of it:
|
| [...@mickey:~]$ cat | python
| print 123
| print 456
| 123
| 456
|
| Is there a way to get Python to process input line-by-line the way it
| does when s
On 2010-08-11, RG wrote:
> When stdin is not a tty, Python seems to buffer all the input through
> EOF before processing any of it:
>
> [...@mickey:~]$ cat | python
> print 123
> print 456
> 123
> 456
>
> Is there a way to get Python to process input line-by-line the way it
> does when stdin is
Lie Ryan wrote:
On 12/22/2009 11:25 PM, Steve Holden wrote:
>
> If you want to extract an index number from the first part of of a
given
> line use split( split_character, maximum_splits_to_do ) and then
angle
> brackets to reference the first part (index 0)...
>
>
a = "20 GOTO 10"
Steve Holden wrote:
> r0g wrote:
>> seafoid wrote:
>>> Hi Guys,
>>>
>>> When python reads in a file, can lines be referred to via an index?
>>>
>>> Example:
>>>
>>> for line in file:
>>> if line[0] == '0':
>>> a.write(line)
>>>
>>> This works, however, I am unsure if line[0] refers on
On 12/22/2009 11:25 PM, Steve Holden wrote:
>
> If you want to extract an index number from the first part of of a given
> line use split( split_character, maximum_splits_to_do ) and then angle
> brackets to reference the first part (index 0)...
>
>
a = "20 GOTO 10"
int( a.split('
r0g wrote:
> seafoid wrote:
>> Hi Guys,
>>
>> When python reads in a file, can lines be referred to via an index?
>>
>> Example:
>>
>> for line in file:
>> if line[0] == '0':
>> a.write(line)
>>
>> This works, however, I am unsure if line[0] refers only to the first line or
>> the fir
seafoid wrote:
> Hi Guys,
>
> When python reads in a file, can lines be referred to via an index?
>
> Example:
>
> for line in file:
> if line[0] == '0':
> a.write(line)
>
> This works, however, I am unsure if line[0] refers only to the first line or
> the first character in all l
Rory,
You are a gentleman!
Thank you very much for your suggestion!
Kind Regards,
Seafoid.
Rory Campbell-Lange wrote:
>
> On 18/12/09, seafoid ([email protected]) wrote:
>> http://old.nabble.com/Parsing-file-format-to-ensure-file-meets-criteria-to26837682.html
>
> Your specification is confus
Hey folks,
Is it possible to assign a list within a nested list to a variable?
Example:
l = [['1', '2', '3'], ['4', '5', '6']]
for i in l:
if i[0][1] == '1':
m = i
Indeed, I generally do not understand how to assign variables within a loop!
Is there an easy way to 'flatten' a nes
On 18/12/09, seafoid ([email protected]) wrote:
> http://old.nabble.com/Parsing-file-format-to-ensure-file-meets-criteria-to26837682.html
Your specification is confusing. However I suggest you break it down
the code so that the steps in your programme are logical. Good luck.
# example psuedocode
he
On 18/12/09, seafoid ([email protected]) wrote:
> Have you any suggestions how I may render this code undead or should I scrap
> it and create something new?
It might be easier for us to help you if you give us an example of your
input file and a clearer description of what you are trying to do with
Hi Guys,
It has been point out that it is difficult for anyone to provide suggestions
if I do not outline more clearly my input file and an example of what I wish
to do with it (Thanks Rory!).
I mentioned it in this thread (Is creating different threads bad etiquette?
If so, lesson learned!):
h
On 12/19/2009 4:33 AM, seafoid wrote:
Thanks for that Lie.
I had to have a think about what you meant when you referred to control
going to a.write(line).
and if-elif-elif-... chain is executed sequentially and when a match is
found, the rest of the chain is skipped. Your code:
if line.sta
Thanks for that Lie.
I had to have a think about what you meant when you referred to control
going to a.write(line).
Have you any suggestions how I may render this code undead or should I scrap
it and create something new?
My confusion and ineptitude is perhaps explained by my being a biologist
On 12/19/2009 3:27 AM, seafoid wrote:
Thanks for that Richard and Steve.
I have another question.
What's the question?
fname = raw_input('Please enter the name of the file: ')
# create file objects
blah = open(fname, 'r')
a = open('rubbish', 'w')
for line in blah:
if line.startswith
Thanks for that Richard and Steve!
Below is my full code so far:
for line in file:
if line.startswith("1"):
a.write(line)
elif line.endswith("0"):
lists_a = line.strip().split()
print lists_a
elif line.startswith("2"):
lists_b = line.strip().split()
Thanks for that Richard and Steve.
I have another question.
fname = raw_input('Please enter the name of the file: ')
# create file objects
blah = open(fname, 'r')
a = open('rubbish', 'w')
for line in blah:
if line.startswith("0"):
a.write(line)
elif line.endswith("0"):
seafoid wrote:
> Hi Guys,
>
> When python reads in a file, can lines be referred to via an index?
>
> Example:
>
> for line in file:
> if line[0] == '0':
> a.write(line)
>
> This works, however, I am unsure if line[0] refers only to the first line or
> the first character in all l
On Dec 18, 3:42 pm, seafoid wrote:
> Hi Guys,
>
> When python reads in a file, can lines be referred to via an index?
>
> Example:
>
> for line in file:
> if line[0] == '0':
> a.write(line)
>
> This works, however, I am unsure if line[0] refers only to the first line or
> the first c
On 2009-11-23, Terry Reedy wrote:
> Neil Cerutti wrote:
>> Unfortunately, the new "nested" with statement (which I also read
>> about today) forces me into this anti-idiom. When replacing an
>> appearance of contextlib.nested with the 3K with statement, I
>> ended up with an unexpected syntax erro
Susan Day wrote:
On Mon, Nov 23, 2009 at 2:26 PM, Gary Herron
mailto:[email protected]>> wrote:
>>> print 'A Message From %s:\n\n %s' % ('someone','some message')
A Message From someone:
some message
So... *Exactly* what are you doing with msg, and *exactly* what
D'Arcy J.M. Cain wrote:
On Mon, 23 Nov 2009 14:46:23 -0500
Susan Day wrote:
First, it does in fact ignore all line breaks, not just double line breaks.
Here's what I'm doing:
session.sendmail(clientEmail, ourEmail2, header+msg)
The email sent out has the message sans breaks.
You should really
MRAB wrote:
Neil Cerutti wrote:
> I installed Python 3.1 today, and I've been porting my small
> library of programs to the new system.
>
> I happened to read the interesting "Idioms and Anti-Idioms"
> HOWTO, and saw the '\' continuation character labeled an
> anti-idiom. I already generall
Neil Cerutti wrote:
I installed Python 3.1 today, and I've been porting my small
library of programs to the new system.
I happened to read the interesting "Idioms and Anti-Idioms"
HOWTO, and saw the '\' continuation character labeled an
anti-idiom. I already generally avoided it, so I just nodde
On Mon, 23 Nov 2009 14:46:23 -0500
Susan Day wrote:
> First, it does in fact ignore all line breaks, not just double line breaks.
> Here's what I'm doing:
> session.sendmail(clientEmail, ourEmail2, header+msg)
> The email sent out has the message sans breaks.
You should really post an entire scri
Neil Cerutti wrote:
> I installed Python 3.1 today, and I've been porting my small
> library of programs to the new system.
>
> I happened to read the interesting "Idioms and Anti-Idioms"
> HOWTO, and saw the '\' continuation character labeled an
> anti-idiom. I already generally avoided it, so I
On Mon, Nov 23, 2009 at 2:26 PM, Gary Herron wrote:
> >>> print 'A Message From %s:\n\n %s' % ('someone','some message')
> A Message From someone:
>
> some message
>
>
> So... *Exactly* what are you doing with msg, and *exactly* what is your
> evidence that line breaks are being ignored. With th
1 - 100 of 163 matches
Mail list logo