12 days > rpa게시판

본문 바로가기

사이트 내 전체검색

뒤로가기 rpa게시판

12 days

페이지 정보

작성자 개발관리자 작성일 22-05-15 22:15 조회 82 댓글 0

본문

print("{0: >10}".format(500))
print("{0: >+10}".format(500))
print("{0: >+10}".format(-500))

print("{0:_<+10}".format(500))

print("{0:,}".format(1000000000))
print("{0:+,}".format(-1000000000))

print("{0:^<+30,}".format(-1000000000))

print("{0:f}".format(5/3))
print("{0:.2f}".format(5/3))



# score_file = open("score.txt", "w", encoding="utf-8")

# print("수학 : 0", file=score_file)
# print("영어 : 50", file=score_file)

# score_file.close()

# score_file = open("score.txt","a", encoding='utf-8')
# score_file.write("과학 : 80")
# score_file.write("\n코딩 : 100")

# score_file.close()

# score_file = open("score.txt","r", encoding='utf-8')
# print(score_file.read());
# score_file.close()

# score_file = open("score.txt","r", encoding='utf-8')
# print(score_file.readline(), end="")
# print(score_file.readline(), end="")
# score_file.close()

# score_file = open("score.txt","r", encoding='utf-8')
# while True:
#    line = score_file.readline()
#    if not line :
#        break
#    print(line, end="")
# score_file.close()

score_file = open("score.txt","r", encoding='utf-8')
lines = score_file.readlines()
for line in lines :
    print(line, end="")
score_file.close()

#피클
import pickle

profile_file = open("profile.pickle", "wb")
profile = {"이름":"박명수", "나이":30, "취미":["축구", "골프", "코딩"]}
print(profile)
pickle.dump(profile_file, profile)
profile_file.close()


profile_file = open("profile.pickle", "rb")
profile = pickle.load(profile_file)
print(profile)
profile_file.close()




#import pickle

#with open("profile.pickle", "rb") as profile_file:
#print(pickle.load(profile_file))


with open("study.txt", "w", encoding="utf8") as study_file:
    study_file.write("파이썬을 열심히 공부하고 있어요.")


for i in range(1, 51):
    with open(str(i) + "주차.txt", "w", encoding="utf-8") as report_file:
        report_file.write("- {0} 주차 주간보고 -".format(i))
        report_file.write("\n부서 :")
        report_file.write("\n이름 :")
        report_file.write("\n업무 요약 :")




# 마린 : 공격 유닛, 군인. 총을 쏠 수 있습니다.

name = "마린"
hp = 40
damage = 5


print("{} 유닛이 생성되었습니다.".format(name))
print("체력 {0}, 공격력 {1}\n".format(hp, damage))


# 탱크 : 공격 유닛, 탱크, 포를 쏠수 있음. 일반 모드/ 시즈 모드

tank_name = "탱크"
tank_hp = 150
tank_damage = 35

print("{} 유닛이 생성되었습니다.".format(tank_name))
print("체력 {0}, 공격력 {1}\n".format(hp, tank_damage))

def attack(name, location, damage):
    print("{0} : {1} 방향으로 적국을 공격합니다. [공격력 {2}]".format(name, location, damage ))


attack(name, "1시", damage)   
attack(tank_name, "1시", tank_damage)   

class Unit:
    def __init__(self, name, hp, damage):
        self.name = name
        self.hp = hp
        self.damage = damage
        print("{0} 유닛이 생성 되었습니다.".format(self.name))
        print("체력 {0}, 공격력 {1}".format(self.hp, self.damage))



marine1 = Unit("마린", 40, 5)
marine2 = Unit("마린", 40, 5)
tank = Unit("탱크", 150, 35)

댓글목록 0

등록된 댓글이 없습니다.

Copyright © open.ajubang.com/mm All rights reserved.
홈 나만의지도만들기W 공개 가장쉬운라벨지만들기 텍스트QR 가장쉬운문자보내기