On Sat, 27 Jun 2009 19:55:17 +0200, Piet van Oostrum wrote:
>> Terry Reedy (TR) wrote:
>
>>TR> Peter Otten wrote:
>> Will your program handle empty lines of input correctly?
> Strangely enough, it seems to do so, but why?
Because there aren't any. When you read lines from
On 6/27/2009 1:25 PM MRAB said...
Emile van Sebille wrote:
On 6/27/2009 3:39 AM Angus Rodgers said...
On Fri, 26 Jun 2009 18:58:27 -0700 (PDT), powah
wrote:
Thank you for your hint.
This is my solution:
f = open('test', 'r')
for line in f:
print line[0].upper()+line[1:],
Will your progr
Emile van Sebille wrote:
On 6/27/2009 3:39 AM Angus Rodgers said...
On Fri, 26 Jun 2009 18:58:27 -0700 (PDT), powah
wrote:
Thank you for your hint.
This is my solution:
f = open('test', 'r')
for line in f:
print line[0].upper()+line[1:],
Will your program handle empty lines of input corr
On 6/27/2009 3:39 AM Angus Rodgers said...
On Fri, 26 Jun 2009 18:58:27 -0700 (PDT), powah
wrote:
Thank you for your hint.
This is my solution:
f = open('test', 'r')
for line in f:
print line[0].upper()+line[1:],
Will your program handle empty lines of input correctly?
It will when the
Terry Reedy wrote:
> Peter Otten wrote:
>
Will your program handle empty lines of input correctly?
>>> Strangely enough, it seems to do so, but why?
>>
>> Because there aren't any. When you read lines from a file there will
>> always be at least the newline character. Otherwise it would ind
> Terry Reedy (TR) wrote:
>TR> Peter Otten wrote:
> Will your program handle empty lines of input correctly?
Strangely enough, it seems to do so, but why?
>>>
>>> Because there aren't any. When you read lines from a file there will
>>> always be at least the newline character. Other
Peter Otten wrote:
Will your program handle empty lines of input correctly?
Strangely enough, it seems to do so, but why?
Because there aren't any. When you read lines from a file there will always
be at least the newline character. Otherwise it would indeed fail:
Except possibly for the l
On Sat, 27 Jun 2009 11:54:43 +0100
Angus Rodgers wrote:
> On Sat, 27 Jun 2009 11:39:28 +0100, I asked rhetorically:
> >>f = open('test', 'r')
> >>for line in f:
> >>print line[0].upper()+line[1:],
> >
> >Will your program handle empty lines of input correctly?
>
> Strangely enough, it seems t
Angus Rodgers wrote:
> Yes, I understood that, and it's logical, but what was worrying me
> was how to understand the cross-platform behaviour of Python with
> regard to the different representation of text files in Windows
> and Unix-like OSs. (I remember getting all in a tizzy about this
If you
On Sat, 27 Jun 2009 13:49:57 +0200, Peter Otten
<__pete...@web.de> wrote:
>Angus Rodgers wrote:
>
>> On Sat, 27 Jun 2009 13:02:47 +0200, Peter Otten
>> <__pete...@web.de> wrote:
>>
>>>Angus Rodgers wrote:
>>>
On Sat, 27 Jun 2009 11:39:28 +0100, I asked rhetorically:
>Will your prog
Angus Rodgers wrote:
> On Sat, 27 Jun 2009 13:02:47 +0200, Peter Otten
> <__pete...@web.de> wrote:
>
>>Angus Rodgers wrote:
>>
>>> On Sat, 27 Jun 2009 11:39:28 +0100, I asked rhetorically:
>>>
Will your program handle empty lines of input correctly?
>>>
>>> Strangely enough, it seems to do s
On Sat, 27 Jun 2009 12:13:57 +0100, I wrote:
>Hmm ... the \r\n sequence at the end of a Win/DOS file seems to be
>treated as a single character.
For instance, if test001A.txt is this file:
abc xyz
Bd ef
gH ij
and test001E.py is this:
f = open('test001A.txt', 'r')
for line in f:
print repr(
On Sat, 27 Jun 2009 12:13:57 +0100, I wrote:
>the \r\n sequence at the end of a Win/DOS file
Of course, I meant the end of a line of text, not the end of
the file.
(I promise I'll try to learn to proofread my posts. This is
getting embarrassing!)
--
Angus Rodgers
--
http://mail.python.org/mai
On Sat, 27 Jun 2009 13:02:47 +0200, Peter Otten
<__pete...@web.de> wrote:
>Angus Rodgers wrote:
>
>> On Sat, 27 Jun 2009 11:39:28 +0100, I asked rhetorically:
>>
>>>Will your program handle empty lines of input correctly?
>>
>> Strangely enough, it seems to do so, but why?
>
>Because there aren'
Angus Rodgers wrote:
> On Sat, 27 Jun 2009 11:39:28 +0100, I asked rhetorically:
>
>>On Fri, 26 Jun 2009 18:58:27 -0700 (PDT), powah
>> wrote:
>>
>>>Thank you for your hint.
>>>This is my solution:
>>>f = open('test', 'r')
>>>for line in f:
>>>print line[0].upper()+line[1:],
>>
>>Will your pr
On Sat, 27 Jun 2009 11:39:28 +0100, I asked rhetorically:
>On Fri, 26 Jun 2009 18:58:27 -0700 (PDT), powah
> wrote:
>
>>Thank you for your hint.
>>This is my solution:
>>f = open('test', 'r')
>>for line in f:
>>print line[0].upper()+line[1:],
>
>Will your program handle empty lines of input co
On Fri, 26 Jun 2009 18:58:27 -0700 (PDT), powah
wrote:
>Thank you for your hint.
>This is my solution:
>f = open('test', 'r')
>for line in f:
>print line[0].upper()+line[1:],
Will your program handle empty lines of input correctly?
--
Angus Rodgers
--
http://mail.python.org/mailman/listinf
On Fri, 26 Jun 2009 18:58:27 -0700 (PDT), powah
wrote:
>On Jun 26, 4:51 pm, Chris Rebert wrote:
>> On Fri, Jun 26, 2009 at 12:43 PM, powah wrote:
>> > How to change the first character of the line to uppercase in a text
>> > file?
>> > [...]
>>
>
On Jun 26, 4:51 pm, Chris Rebert wrote:
> On Fri, Jun 26, 2009 at 12:43 PM, powah wrote:
> > How to change the first character of the line to uppercase in a text
> > file?
> > e.g.
> > input is:
> > abc xyz
> > Bd ef
> > gH ij
>
> > output sh
powah wrote:
How to change the first character of the line to uppercase in a text
file?
Here is an English hint on the above:
The "How ... file" above is a noun phrase, and is not a sentence,
never mind a question. Putting a question mark after the noun phrase
does not make tha
powah wrote:
How to change the first character of the line to uppercase in a text
file?
e.g.
input is:
abc xyz
Bd ef
gH ij
output should be:
Abc xyz
Bd ef
GH ij
While you're asking the Python list, I'd just use GNU sed:
sed -i 's/./\U&/' myfile.txt
I don'
On Fri, Jun 26, 2009 at 12:43 PM, powah wrote:
> How to change the first character of the line to uppercase in a text
> file?
> e.g.
> input is:
> abc xyz
> Bd ef
> gH ij
>
> output should be:
> Abc xyz
> Bd ef
> GH ij
We're not in the business of doi
On 6/26/2009 12:43 PM powah said...
How to change the first character of the line to uppercase in a text
file?
e.g.
input is:
abc xyz
Bd ef
gH ij
output should be:
Abc xyz
Bd ef
GH ij
How far have you gotten?
Emile
--
http://mail.python.org/mailman/listinfo/python-list
How to change the first character of the line to uppercase in a text
file?
e.g.
input is:
abc xyz
Bd ef
gH ij
output should be:
Abc xyz
Bd ef
GH ij
--
http://mail.python.org/mailman/listinfo/python-list
24 matches
Mail list logo