Mohammad Jeffry wrote:
> I tried to use this method in my code like this:-
> ---------------------------------------------------------------------------------
> #!/usr/bin/python
> 
> 
> def print_sql():
>     sql = '''aaaaaaaaaaaaaaaaaaaaaaa
>     bbbbbbbbbbbbbbbbbbbbbbb'''.replace("\n","")
>     print sql
> 
> print_sql()
> 
> ---------------------------------------------------------------------------------
> 
> the ouput of this is aaaaaaaaaaaaaaaa<space><tab>bbbb......
> 
> I can always do this :-
> ---------------------------------------------------------------------------------
> #!/usr/bin/python
> 
> 
> def print_sql():
>     sql = '''aaaaaaaaaaaaaaaaaaaaaaa
> bbbbbbbbbbbbbbbbbbbbbbb'''.replace("\n","")
>     print sql
> 
> print_sql()
> 
> ---------------------------------------------------------------------------------
> 
> but it looks ugly
> 
> 
[...]
In your particular case, if it really is SQL you're dealing with then 
you shouldn't worry about what it looks like when you print it - the SQL 
interpreter certainly won't care.

Many SQL statements are so long that it actually helps readability to 
have newlines in them.

There have been plenty of solutions presented in the  earlier posts in 
this thread if you really do need to represent multi-line strings.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to