04 字符串计算.pptVIP

  • 4
  • 0
  • 约 35页
  • 2017-08-15 发布于河南
  • 举报
字符串计算 Computing with Strings 本章作业 教材 4.6 Exercises (p65): 1~4, 6, 8, 9, 11~13, 15~18 文本数据 计算机应用从科学计算转向信息管理 信息管理中大量的数据都是文本数据 如:姓名、地址、简历等等 问题:身份证号码,电话号码等是数值? 计算机中用字符串来表示文本数据 典型例子:字处理软件 本章内容 The String(字符串) Data Type Simple String Processing Strings and ASCII system Output as String Manipulation (格式化输出) File Processing(文件处理) 字符串类型 字符序列 用一对单引号/双引号标明 hello world ~!@#$%^* 汉字也是字符 字符串类型 字符串中包含引号怎么办? 单引号:用双引号 双引号:用单引号 用转义字符:\ print “Alice said, \“Hello, ’Bob’\”” 字符串的输入 错误输入: str = input(“Enter a string: “) 原因: input() 是把输入当成表达式来计算的! 解决方法: 输入时加上引号 使用raw_input() Input() 与 raw_input() x = input()

文档评论(0)

1亿VIP精品文档

相关文档