Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
SQL クエリから返されたすべての NoneType オブジェクトを空の文字列に変換する方法はありますか? 今、私はやっています
curs.execute(query) for foo, bar, baz in curs.fetchall(): foo = foo or '' bar = bar or '' baz = baz or ''
しかし、もっと良い方法があると確信しています。
ありがとう
このようなもの
new_list = [ ('' if x is None else x) for x in curs.fetchall() ]