Ratheesh kumar writes:
> Here is my code..try:
> data=open('info.txt')
[…]
Please be sure to present the code as distinct lines.
You have posted it as plain text (good), the indentation is preserved
(good). The problem here is that your commentary is mingled with the
program code, so that
Here is my code..try:
data=open('info.txt')
for each_line in data:
try:
(role,line_spoken)=each_line.split(':',1)
print(role,end='')
print(' said: ',end='')
print(line_spoken,end='')
except ValueError:
print(each_li
Hi Uma,
In your case, I'd look at the file as a sequence of "tokens" and look
at this as a tokenization problem
I think we'll see some kind of _identifier_, followed by _whitespace_,
followed by a _string_. All these three tokens will repeat, until we
hit the end of the the file.
More formally
i agree.
i expect the output be
"all the best"
"all the best 2 next line\n check this"
On Wed, Jun 18, 2014 at 6:24 PM, Danny Yoo wrote:
> On Wed, Jun 18, 2014 at 6:08 PM, Umamaheshwar Rao
> wrote:
> > Hi Experts,
> >
> > I have a file with below format
> >
>
>
> Can you describe the format
On Wed, Jun 18, 2014 at 6:08 PM, Umamaheshwar Rao
wrote:
> Hi Experts,
>
> I have a file with below format
>
Can you describe the format a little more precisely? You're giving
examples, which is wonderful. But the examples are missing something.
What's the output you want to get here? Imagi
Hi Experts,
I have a file with below format
this is first file operation
x-1 "all the best"
x-2 "all the best 2 next line
check this"
x-3 "last line"
i need extract the lines starting with x-1 and x-2, can some throw some
light on how to do?
Thanks,
Uma