简体   繁体   English

python mysqldb打印文本,即使代码中没有打印语句

[英]python mysqldb printing text even if no print statement in the code

This is my program 这是我的程序

import MySQLdb as mdb 将MySQLdb导入为mdb

from MySQLdb import IntegrityError 从MySQLdb导入IntegrityError

conn = mdb.connect("localhost", "asdf", "asdf", "asdf") conn = mdb.connect(“ localhost”,“ asdf”,“ asdf”,“ asdf”)

when the connect function is called python prints some text ("h" in the shell). 当调用connect函数时,python打印一些文本(shell中的“ h”)。 This happens only if I execute the script file from a particular folder. 仅当我从特定文件夹执行脚本文件时,才会发生这种情况。 If I copy the same script file to some other folder "h" is not printed. 如果我将同一脚本文件复制到其他文件夹,则不会打印“ h”。

actually i had this line previously in the same script for testing 实际上我以前在同一脚本中进行过测试

print "h" 打印“ h”

but now i have removed the line from the script. 但是现在我已经从脚本中删除了这一行。 But still it is printed. 但它仍然是印刷的。 What happen to my folder? 我的文件夹怎么了?

Try deleting *.pyc files. 尝试删除* .pyc文件。 Secondly use script with -v option so that you can view from where the file is being imported 其次,将脚本与-v选项一起使用,以便您可以从文件导入位置进行查看

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM