0
나는 python 스크립트를 사용하여 sqlite3 데이터베이스에서 문자열 목록을 가져오고 있습니다. sqlite3 데이터베이스에서 문자열을 가져 왔을 때 루프 외부의 전체 문자열 목록 만 인쇄 할 수 있기 때문에 각 문자열을 인쇄 할 수 없습니다.문자열 목록을 인쇄하는 방법?
나는이 사용하는 경우 :
programList = list()
# set the channels text
for index in range(0, CHANNELS_PER_PAGE):
#get the programs list
cur.execute('SELECT channel, title, start_date, stop_date FROM programs WHERE channel=?', [channel])
programs = cur.fetchall()
for row in programs:
title = row[1].encode('ascii')
if program_width > 1:
programList.append(title)
programTitle = programList
print programTitle
는이 같은 결과를 얻을 것이다 :
21:17:50 T:5172 NOTICE: ['The Middle - The Ditch', 'The Goonies', 'Pirates of the
Caribbean: On Stranger Tides', 'The 700 Club', 'The Fresh Prince of Bel-Air -
Day Damn One', 'The Fresh Prince of Bel-Air - Lucky Charm', 'The Fresh Prince of
Bel-Air - The Ethnic Tip', 'The Fresh Prince of Bel-Air - The Young and the
Restless', 'Summer Sexy With T25!', Paid Programming', 'The 700 Club', "Shaun T's
Focus T25", 'Sleep Better!', 'Joseph Prince', 'Life Today With James Robison -
Christine Caine - FOY, MOR 1', 'Joyce Meyer: Enjoying Everyday Life', 'Amazing Facts
Presents', "That '70s Show - Who Wants It More?", "That '70s Show - Fez Gets the Girl",
"That '70s Show - Dine and Dash", "That '70s Show - Radio Daze", '700 Club Special
Programming', 'Gilmore Girls - A Deep-Fried Korean Thanksgiving', '8 Simple Rules -
Princetown Girl', '8 Simple Rules - A Very C.J. Christmas', 'Reba - And the Grammy
Goes To ...', 'Reba - The Wall', 'Reba - The Best Defense', 'Reba - For Sale, Cheap',
'Boy Meets World - State of the Unions', 'Boy Meets World - Show Me the Love', 'Boy
Meets World - For Love and Apartments', "Boy Meets World - Angela's Men", 'The Middle
- The Cheerleader', 'The Middle - The Block Party', 'The Middle - The Floating
Anniversary', 'The Middle - The Trip', 'Melissa & Joey - Right Time, Right Place',
"Melissa & Joey - Don't Look Back in Anger", 'Melissa & Joey - Accidents Will Happen',
'Baby Daddy - Send in the Clowns', 'Liar Liar', 'The 700 Club', 'Baby Daddy -
Flirty Dancing', 'Baby Daddy - Send in the Clowns'
..etc
는이 같은 결과를 확인하려면 : 당신이
21:20:01 T:5796 NOTICE: The Middle - The Ditch
21:20:01 T:5796 NOTICE: The Goonies
21:20:01 T:5796 NOTICE: Pirates of the Caribbean: On Stranger Tides
21:20:01 T:5796 NOTICE: The 700 Club
21:20:01 T:5796 NOTICE: The Fresh Prince of Bel-Air - Day Damn One
21:20:01 T:5796 NOTICE: The Fresh Prince of Bel-Air - Lucky Charm
21:20:01 T:5796 NOTICE: The Fresh Prince of Bel-Air - The Ethnic Tip
21:20:01 T:5796 NOTICE: The Fresh Prince of Bel-Air - The Young and the Restless
21:20:01 T:5796 NOTICE: Summer Sexy With T25!
21:20:01 T:5796 NOTICE: Paid Programming
21:20:01 T:5796 NOTICE: The 700 Club
21:20:01 T:5796 NOTICE: Shaun T's Focus T25
21:20:01 T:5796 NOTICE: Sleep Better!
21:20:01 T:5796 NOTICE: Joseph Prince
21:20:01 T:5796 NOTICE: Life Today With James Robison - Christine Caine - FOY, MOR 1
21:20:01 T:5796 NOTICE: Joyce Meyer: Enjoying Everyday Life
21:20:01 T:5796 NOTICE: Amazing Facts Presents
21:20:01 T:5796 NOTICE: That '70s Show - Who Wants It More?
21:20:01 T:5796 NOTICE: That '70s Show - Fez Gets the Girl
21:20:01 T:5796 NOTICE: That '70s Show - Dine and Dash
21:20:01 T:5796 NOTICE: That '70s Show - Radio Daze
21:20:01 T:5796 NOTICE: 700 Club Special Programming
21:20:01 T:5796 NOTICE: Gilmore Girls - A Deep-Fried Korean Thanksgiving
21:20:01 T:5796 NOTICE: 8 Simple Rules - Princetown Girl
21:20:01 T:5796 NOTICE: 8 Simple Rules - A Very C.J. Christmas
21:20:01 T:5796 NOTICE: Reba - And the Grammy Goes To ...
21:20:01 T:5796 NOTICE: Reba - The Wall
21:20:01 T:5796 NOTICE: Reba - The Best Defense
21:20:01 T:5796 NOTICE: Reba - For Sale, Cheap
21:20:01 T:5796 NOTICE: Boy Meets World - State of the Unions
21:20:01 T:5796 NOTICE: Boy Meets World - Show Me the Love
21:20:01 T:5796 NOTICE: Boy Meets World - For Love and Apartments
21:20:01 T:5796 NOTICE: Boy Meets World - Angela's Men
21:20:01 T:5796 NOTICE: The Middle - The Cheerleader
21:20:01 T:5796 NOTICE: The Middle - The Block Party
21:20:01 T:5796 NOTICE: The Middle - The Floating Anniversary
21:20:01 T:5796 NOTICE: The Middle - The Trip
21:20:01 T:5796 NOTICE: Melissa & Joey - Right Time, Right Place
21:20:01 T:5796 NOTICE: Melissa & Joey - Don't Look Back in Anger
21:20:01 T:5796 NOTICE: Melissa & Joey - Accidents Will Happen
21:20:01 T:5796 NOTICE: Baby Daddy - Send in the Clowns
을 할 수 바랍니다 내가 실제로 원하는 결과를 얻기 위해 루프 외부의 각 문자열을 어떻게 인쇄 할 수 있는지 예제 코드를 보여 주시겠습니까?
당신이 목록 반복 시도? –
게시 한 프로그램이 샘플 출력과 일치하지 않습니다. '21:17:50 T : 5172 NOTICE :'어디서 온 것이고 어쨌든 코드는 실행되지 않을 것입니다. 무엇이'program_width'입니까? –