S
Steve Holden
[...]Mohammad said: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()
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