嗨,所以我正在制作一个Python脚本,该脚本读取信用卡中的磁条,我需要一些东西让我从B切成^,所以我尝试了拆分,但它给了我一个错误。 卡的输出是伪造的,仅用于测试。 真的需要有关python中拆分内容的帮助,真的希望它能正常工作!
信用卡输出:
%B4146452892178642^SMITH/JOHN ^1505101100001100000000387000000?;E?
错误:
Credit card detected
Traceback (most recent call last):
File "Cloner.py", line 102, in <module>
main()
File "Cloner.py", line 46, in main
clone_startUP()
File "Cloner.py", line 60, in clone_startUP
clone_type()
File "Cloner.py", line 67, in clone_type
CreditCard()
File "Cloner.py", line 80, in CreditCard
number = data.split("B", "^")
TypeError: 'str' object cannot be interpreted as an integer
代码:
import pickle
import os
import sys
import time
def main():
os.system('cls' if os.name == 'nt' else 'clear')
if not os.path.exists("Credit Cards") and not os.path.exists("Other Cards"):
os.makedirs("Credit Cards")
os.makedirs("Other Cards")
print("Creating needed files")
print("Please Whait")
print("-----5-----")
time.sleep(1)
print("-----4-----")
time.sleep(1)
print("-----3-----")
time.sleep(1)
print("-----2-----")
time.sleep(1)
print("-----1-----")
time.sleep(1)
if os.path.exists("Credit Cards") and os.path.exists("Other Cards"):
os.system('cls' if os.name == 'nt' else 'clear')
print("Files created")
clone_startUP()
else:
os.system('cls' if os.name == 'nt' else 'clear')
print("If this erro continues plz create files manually")
print("------------------------------------------------")
print("Foulder Names:")
print("1 - Creadit Cards")
print("2 - Other Cards")
sys.exit()
else:
clone_startUP()
def clone_startUP():
global data
os.system('cls' if os.name == 'nt' else 'clear')
print("Please insert a card:")
data = input()
if data == "":
clone_startUP()
else:
clone_type()
def clone_type():
if data[1:2] == "B":
os.system('cls' if os.name == 'nt' else 'clear')
print("Credit card detected")
CreditCard()
else:
OtherCard()
def CreditCard():
global number
global first_date
global second_date
global first_name
global last_name
global cvv
number = data.split("B", "^")
first_date = data.split("^",2)
second_date = data.split("^",2,5)
first_name = data.split("^","/")
last_name = data.split("/","^")
cvv = data[-14:-10]
credit_info()
def credit_info():
os.system('cls' if os.name == 'nt' else 'clear')
print(first_name)
print(last_name)
print(number)
print(first_date + "/" + second_date)
print(cvv)
main()
答案 0 :(得分:0)
该错误是由split 的第二个参数maxsplit
从文档中
如果给出了maxsplit,则最多完成maxsplit分割(因此,列表 最多具有maxsplit + 1个元素)
但是您在^
中指定了number = data.split("B", "^")