python 数据处理入门0

这篇博客介绍了Python的数据处理基础知识,包括变量和数据类型,如operator和基本函数;详细讲解了List、Tuple、Set和Dictionary等数据结构的使用,以及如何进行文件操作。还涉及了控制语句、函数定义,包括lambda函数,以及如何导入和使用Python包。
摘要由CSDN通过智能技术生成

this file is derived from exercise 0

#1. Variables and data types

1.1 operator

Some relational operators:

Symbol Task Performed
== True, if both sides are equal
!= True, if both sides are not equal
< True, if the left side is smaller
> True, if the left side is greater
<= True, if the left side is smaller or equal to the right side
>= True, if the left side is greater or equal to the right side

1.2 basic functions

  • print()
x = "Hello"
y = "World"
print (x + y)
# "HelloWorld"
  • type(variable)
  • str(variable)
  • len(variable)

2. Data Structures

2.1 List

List can contain datas with same or different types, List is mutable.

lol = [[1,2,3], ["a","b","c"], [1.2,2.3,4.5,6.7,8.9]]
  • lol.append(value)
  • x = lol.pop(), pop out the last element of lol
  • lol.length()

2.2 Tuple

Tuples are just the same as lists, but are immutable.

t = (1,2,3)
t1 = ((1,2),(1,3),3)

2.3 Set

Sets are similar collections, but have no order and can contain each element only once.

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值