嗨所以我正在尝试做一些非常简单的事情
我有Array
大量的句子被随机用于 slideDown 通知 div。因为我不想在 PyCharm 中有很长的 1 行,所以我想我可以将句子从 txt 文件导入到我的Array
.
我发现了这个和这个,所以我导入了numpy,并使用下面的代码,但是,它在行上中断(并跳到我的错误消息)success_msgs
,我也没有收到错误。
def create_request(self):
# text_file = open("success_requests.txt", "r")
# lines = text_file.readlines()
# print lines
success_msgs = loadtxt("success_request.txt", comments="#", delimiter="_", unpack=False)
#success_msgs = ['The intro request was sent successfully', "Request sent off, let's see what happens!", "Request Sent. Good luck, may the force be with you.", "Request sent, that was great! Like Bacon."]
有什么想法吗?:(
我的文本文件(与 py 文件位于同一文件夹中:
The intro request was sent successfully_
Request sent off, let's see what happens!_
Request Sent. Good luck, may the force be with you._
Request sent, that was great! Like Bacon._
调试器
我的 def genfromtxt
def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
skiprows=0, skip_header=0, skip_footer=0, converters=None,
missing='', missing_values=None, filling_values=None,
usecols=None, names=None,
excludelist=None, deletechars=None, replace_space='_',
autostrip=False, case_sensitive=True, defaultfmt="f%i",
unpack=None, usemask=False, loose=True, invalid_raise=True):
genfromtxt 调试: