java和python读取键盘输入

Java:

import java.util.Scanner;

Scanner sc = new Scanner(System.in);
//获取数字
int num = sc.nextInt();
//获取一行
String line  = sc.nextLine();

Python:

# 返回字符串
str = raw_input("Enter your input: ")

# 返回字符串的运算结果
str = input("Enter your input: ")

 

你可能感兴趣的:(java)