By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,109 Members | 1,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,109 IT Pros & Developers. It's quick & easy.

jython code

P: 4
Hi,

When I execute below program I am getting the below output.

Expand|Select|Wrap|Line Numbers
  1. for row in c.fetchall():
  2.         urls=row
  3.         print urls
  4.  
('http://10.136.229.129:7010',)
('http://10.136.229.129:7020',)
('http://10.136.229.129:7030',)
('http://10.136.229.129:7040',)
('http://10.136.229.44:7050',)
('http://10.136.229.44:7060',)
('http://10.136.229.44:7070',)
('http://10.136.229.44:7080',)


but I want to get below output

http://10.136.229.129:7010
http://10.136.229.129:7020
http://10.136.229.129:7030
http://10.136.229.129:7040
http://10.136.229.44:7050
http://10.136.229.44:7060
http://10.136.229.44:7070
http://10.136.229.44:7080

Please let me know how can I achieve this by either python or jython script

Regards
spgreddy
Dec 15 '14 #1
Share this Question
Share on Google+
1 Reply


bvdet
Expert Mod 2.5K+
P: 2,851
c.fetchall() returns a list of tuples. To cover the possibility of an empty tuple or tuple with multiple entries:
Expand|Select|Wrap|Line Numbers
  1. print "\n".join([",".join(item) for item in c.fetchall()])
Dec 15 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.