This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Hello World!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { Helmet } from "react-helmet"; | |
import { uuid } from "uuidv4"; | |
import "./styles.css"; | |
import "bootstrap/dist/css/bootstrap.min.css"; | |
import TitleBar from "./components/titleBar"; | |
import GameArea from "./components/gameArea"; | |
export default class App extends React.Component { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
from io import StringIO | |
import re | |
import time | |
# 基本變數設定 | |
base_url = 'http://ptt.cc' | |
sub_base_url = '/bbs/Gossiping/index.html' # ptt gossiping url | |
full_url = base_url + sub_base_url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="r-ent"> | |
<div class="nrec"><span class="hl f3">30</span></div> | |
<div class="title"> | |
<a href="/bbs/Gossiping/M.1602763376.A.198.html">[新聞] 留不住人!北市家防中心近5年平均離職率</a> | |
</div> | |
<div class="meta"> | |
<div class="author">ruby00514</div> | |
<div class="article-menu"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_some_names(**kwargs): | |
for key, val in kwargs.items(): | |
print(f'{key}: {val}') | |
# 以下輸出: | |
# students: ['Jack', 'Leon', 'Claire'] | |
# absent: Jill | |
# over_time: True | |
print_some_names(students=['Jack', 'Leon', 'Claire'], absent='Jill', over_time=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum(*agrs): | |
result = 0 | |
for nums in agrs: | |
result += nums | |
return result | |
print(sum(1, 2, 3, 4, 5)) # 輸出15 | |
print(sum(2, 4)) # 輸出6 | |
print(sum(5, 6, 7, 8, 9, 10)) # 輸出45 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result = [student_names[i] for i in range(len(is_absent)) if not is_absent[i]] | |
print(result) # 輸出['John', 'Leon', 'Jill'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
result = [] | |
for i in range(len(is_absent)): | |
if not is_absent[i]: | |
result.append(student_names[i]) | |
print(result) # 輸出['John', 'Leon', 'Jill'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
age = 17 | |
print('Hello there, are you over 18 years old?') | |
print(f'{"yes" if age >= 18 else "no"}') # 輸出no |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name = 'Kevin' | |
age = 28 | |
job = 'Software Developer' | |
hobby = 'coding' | |
line = f'Hi there, I am {name}, {age} years old. Currently working as a {job}, my hobby is {hobby}' | |
print(line) |
NewerOlder