[个人笔记]C# Excel操作[1] python代码日记

public void Excel() {
    /// Excel应用程序
    Application application = new Application();
    /// 工作簿集合
    Workbooks books = application.Workbooks;
    /// 工作簿
    _Workbook book = null;
    /// 打开工作表文件
    book = books.Add(@"D:\Template\src\manage.xlsx");
    /// 页数
    Worksheet sheet = book.Sheets["Sheet1"];
    
    
    Range cell = sheet.Cells[2, 1];
    cell.Value = "唯我超电磁炮永世长存!";
    Range cell2 = sheet.Cells[2, 2];
    cell2.Value = "上琴一生推!";
    Range cell3 = sheet.Cells[2, 3];
    cell3.Value = "白井黑子!";
    /// 行数
    int rows = sheet.UsedRange.Rows.Count;
    /// 列数
    int column = sheet.UsedRange.Columns.Count;
    for (int i = 1; i <= rows; i++) {
        for (int j = 1; j <= column; j++) {
            Range cell4 = sheet.Cells[i, j];
            string d = cell4.Value;
            Console.Write($"{d}\t");
        }
        Console.WriteLine();
    }
    book.Save();
}

import math;
print('唯我超电磁炮永世长存!');
print('X----');
print(' ||||-');
print('*' * 10);
true = True;
false = False;
price = 10;
rating = 4.9;
name = '御坂美琴';
is_published = true;
print(price);
name = input('你的名字是? ');

print('你好! '+name);
color = input('喜欢的颜色是? ');
print(name+' 喜欢 '+color);

birth = input('出生日期? ');
print(type(birth));
age = 2021 - int(birth);
print(type(age))
print(age);
course = " ' 是单引号";
msg = '''
唯我超电磁炮永世长存!
你指尖跃动的电光,是我此生不变的信仰!
音无结弦之时,悦动天使之心,立于浮华之世,奏响天籁之音!
''';
msg = 'Python for beginners';
msg_ = msg[:];
print(msg_);
msg = 'Jennifer';
msg_ = msg[1:-1];
print(msg_);
first = 'John';
last = 'Smith';
# msg = first+' ['+last+'] is a coder';
msg = f'{first} [{last}] is a coder';
msg = 'Python for beginners';
print(msg.upper());
print(msg.lower());
msg = 'Python for beginners';
exist = 'Python' in msg;
print(exist);
print(10 ** 3);
x = 10;
x = x+3;
x = (2+3)*10-3;
print(x);

print(math.floor(2.9));

is_hot = false;
is_cold = false;
if is_hot:
    print("It's a hot day");
    print('drink plenty of water');
elif is_cold:
    print("It's a cold day");
    print("Wear warm clothes");
else:
    print("It's a lovely day");

print('enjoy you day');
price = 1000000;
has_good_credit = true;
# down_payment = 0;
if has_good_credit:
    down_payment = 0.1*price;
else:
    down_payment = 0.2*price;
print(f'Down payment:${down_payment}');
has_high_income = true;
has_good_credit = true;
has_criminal_record = true;
#
if has_good_credit and not has_criminal_record:
    print('可以贷款');


temperature = 30;

if temperature > 30:
    print("It's a hot day");
    # print('drink plenty of water');
# elif is_cold:
#     print("It's a cold day");
#     print("Wear warm clothes");
else:
    print("It's a lovely day");

temperature = 35;
if temperature > 30:
    print('天气好热');
else:
    print('真是凉爽的一天啊');
name = 'liusu';
if len(name)<3:
    print('名称至少是3位')
elif len(name)>50:
    print('名称必须小于50位');
else:
    print('名称符合要求')

weight = int(input('体重? '));
unit = input('单位? ');
if unit.upper() == 'L':
    weight = int(weight * 0.45);
    print(f'你的体重是 {weight} kg')
else:

    print(f'你的体重是 {weight} kg')
2021-5-28*2021-6-18*level-1
i = 1
while i <= 5:
    print(i*"*")
    i += 1
print('完成!')
secret_number = 9
guess_count = 1
guess_limit = 3
while guess_count <= guess_limit:
    guess_number=int(input('number: '))
    if guess_number==secret_number:
        print('you win!')
        break
    guess_count+=1
else:
    print('you are failed')
command = ''
started = false;
while true:
    command=input('> ')
    if command=='start':
        if started:
            print('the car already started')
        else:
            started = true
            print('the car started')
    elif command=='stop':
        if started:
            started = false
            print('the car stopped')
        else:
            print('the car already stopped')
    elif command == 'quit':
        print('the program is quit')
        break
    elif command=='help':
        print('''
            start - to start the car
            stop - to stop the car
            quit - quit

        ''')
    else:
        print('sorry i can not understand that')


for item in range(50,100,3):
    print(item)
prices = [10,20,30]
total = 0
for price in prices:
    total+=price
print(f'total={total}')
for i in range(4):
    for j in range(3):
        print(f'({i},{j})')
numbers=[5,2,5,2,2]
for x_count in numbers:
    x = ''
    for j in range(x_count):
        x = x+'x'
    print(x)

names = ['流苏', '飞扬', '青丝', '大飞', '水洗', '今夕', '木系', '获悉', '突袭', '炎之吐息', '岩之枪']
# print(names[2:4])
names[0] = '唯我超电磁炮永世长存'
print(names)
numbers = [3,6,2,10,8,4,10]
max = numbers[0]
for i in numbers:
    if i>max:
        max = i
print(max)
matrix = [
    [1,2,3],
    [4,5,6],
    [7,8,9]
]
for i in matrix:
    for j in i:
        print(j)
matrix[1][1] = 20
print(matrix[1][1])
numbers = [5, 2, 1, 7, 4,5]
index1 = numbers.index(7)

print(numbers.count(5))
numbers.sort()
numbers.reverse()
num = numbers.copy()
numbers.append(10)
print(num)

x1 = [2,2,4,6,3,4,6,1]
x2 = []
for x in x1:
    if x not in x2:
        x2.append(x)
print(x2)

numbers = (1,2,3)
print(numbers[0])
coordinates = [45,78,56]
x = coordinates[0]
y = coordinates[1]
z = coordinates[2]
x,y,z = coordinates

print(x*y*z)

customer = {
    'name':'流苏',
    'age': 30,
    'is_verified': true
}
customer['age_'] = 1
print(customer.get('age_',35))

phone = {
    '1':'one',
    '2': 'two',
    '3': 'three',
    '4': 'four',
    '5': 'five',
    '6': 'six',
    '7': 'seven',
    '8': 'eight',
    '9': 'nine',
    '0': 'zero'
}
number = input('请输入您的电话号码: ')
out = ''
for item in number:
    out = out + phone[item] + ' '
print(out)
message = input('> ')
msg = message.split(' ')
print(msg)

def greet_user(first_name,last_name):
    print(f'{first_name}{last_name} :唯我超电磁炮永世长存!')
    # print('音无结弦之时,悦动天使之心,立于浮华之世,奏响天籁之音!')
print('start')
greet_user(first_name='御坂',last_name='美琴')
print('finish')
if true:
    print(25)




































评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值