每当尝试使用像python这样的input()函数使用ipython notebook从键盘输入值时,就会出错.
EOFError Traceback (most recent call last)
<ipython-input-1-725a22d6f154> in <module>()
8 #Reads three Input values for x,y and z
9 print "Enter Values of x, y, z :- "
---> 10 x = input()
11 y = input()
12 z = input()
EOFError: EOF when reading a line
Run Code Online (Sandbox Code Playgroud)
同样在python中正常工作.我怎么能在ipython笔记本环境中这样做?
提前致谢.
python中的str的strncpy()是否有任何等效函数?我想从第一个字符串中替换第二个字符串中的6个字符.'美妙'应该被'美丽'取代.以下是C中的代码.
str1 = "wonderful";
str2 = "beautiful";
strncpy(str2,str1,6);
Run Code Online (Sandbox Code Playgroud)
我想在python中这样做.
提前致谢.
我怎样才能在Python中执行此操作?
strnset(string,symbol,n);
Run Code Online (Sandbox Code Playgroud)
输出应该是:
Enter String : ABCDEFGHIJ
Enter Symbol for replacement : +
How many string characters to be replaced : 4
Before strnset() : ABCDEFGHIJ
After strnset() : ++++EFGHIJ
Run Code Online (Sandbox Code Playgroud)