'분류 전체보기'에 해당되는 글 96건

  1. 2023.12.21 Qslider Style Sheet
  2. 2022.05.13 학점 Grade 계산
  3. 2022.04.15 lambda
  4. 2022.04.15 Folder 생성/삭제, File 생성/삭제
  5. 2022.04.15 Open / Save File Dialog
  6. 2022.04.14 DeskTop path, Zip file
  7. 2022.04.07 cnvtol,comp,,1e-2
  8. 2022.04.04 Auto Complete Jupyter NoteBook
  9. 2021.08.30 Selenium Code
  10. 2021.06.15 ACT Numpy
카테고리 없음2023. 12. 21. 08:55
QSlider::groove:horizontal {
border: 1px solid #bbb;
background: white;
height: 10px;
border-radius: 4px;
}

QSlider::sub-page:horizontal {
background: qlineargradient(x1: 0, y1: 0,    x2: 0, y2: 1,
    stop: 0 #66e, stop: 1 #bbf);
background: qlineargradient(x1: 0, y1: 0.2, x2: 1, y2: 1,
    stop: 0 #bbf, stop: 1 #55f);
border: 1px solid #777;
height: 10px;
border-radius: 4px;
}

QSlider::add-page:horizontal {
background: #fff;
border: 1px solid #777;
height: 10px;
border-radius: 4px;
}

QSlider::handle:horizontal {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
    stop:0 #eee, stop:1 #ccc);
border: 1px solid #777;
width: 13px;
margin-top: -2px;
margin-bottom: -2px;
border-radius: 4px;
}

QSlider::handle:horizontal:hover {
background: qlineargradient(x1:0, y1:0, x2:1, y2:1,
    stop:0 #fff, stop:1 #ddd);
border: 1px solid #444;
border-radius: 4px;
}

QSlider::sub-page:horizontal:disabled {
background: #bbb;
border-color: #999;
}

QSlider::add-page:horizontal:disabled {
background: #eee;
border-color: #999;
}

QSlider::handle:horizontal:disabled {
background: #eee;
border: 1px solid #aaa;
border-radius: 4px;
}
Posted by 오늘보다 나은 내일
카테고리 없음2022. 5. 13. 10:00

import pandas as pd
df = pd.DataFrame([80,90,70,50,40],columns=['mathVal'])
df['Grade'] =list(map(lambda x: "A" if (x >=90) else ("B" if (x >=80) else ("C" if (x >=70) else "D")),df.mathVal))

print(df)
Posted by 오늘보다 나은 내일
카테고리 없음2022. 4. 15. 10:17

map, reduce, filter..

 

 

score = lambda x: "A등급" if x >= 80 else ("B등급" if x >= 70 else "C등급")

 

# ----------------------------------------------------------

add = lambda a, b: a+b
result = add(3, 5) 

 

# ----------------------------------------------------------

arr = [[1,2,9],
       [5,1,8],
       [3,7,9]]
# 2열이 가장 큰 행 
print(max(arr, key=lambda x: x[1]))   # [3,7,9]
# 2열이 가장 큰 행의 3번째 요소
print(max(arr, key=lambda x: x[1])[2])   # 9

 

# ----------------------------------------------------------

a = [1, 6, 2, 5, 2, 7, 2, 8, 9, 11, 5, 26]
result = list(map(lambda x : x**2, a))  # 제곱시키기
print(result)
result2 = list(map(lambda x : str(x) if x % 2 == 0 else x, a))   # 짝수인 것은 string 타입으로 cast 아니면 단순히 반환
print(result2)

b = [12, 16, 24, 5, 20, 27, 12, 8, 9, 110, 51, 26]
result3 = list(map(lambda x, y : x + y, a, b))  # 리스트 자료형 두 개 받아서 연산
print(result3)

# ----------------------------------------------------------

full_name = lambda first, last: f'Full name: {first.title()} {last.title()}'
full_name('Fname', 'Name')
 

# ----------------------------------------------------------

def square(x):
    return lambda : x*x

listOfLambdas = [square(i) for i in [1,2,3,4,5]]
for f in listOfLambdas:
    print(f())

listOfLambdas = [lambda i=i: i*i for i in range(1, 6)]
for f in listOfLambdas:
   print(f())

 

 

 

Posted by 오늘보다 나은 내일
카테고리 없음2022. 4. 15. 09:46
import os
paths = list(map(lambda i: f'./folder_{i:02d}', range(15)))
for path in paths:
    os.mkdir(path)

 

import os

[os.remove(f) for f in glob.glob('./test/*.log')] 

 

import os 

os.rmdir(folder)    # 빈 폴더가 아니면 error 발생

 

import shutil 

shutil.rmtree(folder)  # 폴더 안에 파일이 있어도 삭제

 

import os

path = './dir/sub_dir/tmp1'

os.makedirs(path, exist_ok=True)

 

 

os.path.exists(path or file)

 

os.path.isdir(dir)

os.path.isfile(file) # 파일이 존재하지 않는 경우, folder 인 경우  False 

 

 

import os
files = list(map(lambda i: f'file_{i:02d}.txt', range(20)))
for file in files:
    f = open(file,'w')
    f.write('test\n')
    f.close()
   
 
import glob
[os.remove(f) for f in glob.glob('*.txt')]
 
 
Posted by 오늘보다 나은 내일
카테고리 없음2022. 4. 15. 08:49
# ==============================================================
# Open Save File Dialog
import sys
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')

from System.Windows.Forms import *
from System.Drawing import *

fileDialog = SaveFileDialog()
fileDialog.InitialDirectory = 'C://'
fileDialog.DefaultExt = "txt"
fileDialog.Filter = "Text files (*.txt) | *.txt"
fileDialog.ShowDialog()

try:
    file = open(fileDialog.FileName,"wt")
except ValueError:
    sys.exit("Stop Execution : File is not selected!!")
   
# with open(fileDialog.FileName,"wt") as file:



# ==============================================================
# Open Opem File Dialog

import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')

from System.Windows.Forms import *
from System.Drawing import *

fileDialog = OpenFileDialog()
fileDialog.InitialDirectory = 'C://'
fileDialog.DefaultExt = "txt"
fileDialog.Filter = "Text files (*.txt) | *.txt"
fileDialog.ShowDialog()


try:
    file = open(fileDialog.FileName,"rt")
except ValueError:
    sys.exit("Stop Execution : File is not selected!!")
     
# with open(fileDialog.FileName,"wt") as file:


Posted by 오늘보다 나은 내일
카테고리 없음2022. 4. 14. 09:57
import os
os.path.expanduser('~')
os.path.join(os.path.expanduser('~'),'Desktop')

 

 

 

>> open and unzip file 

 

 

import os 
import zipfile

import tkinter as tk
from tkinter import filedialog
 
root = tk.Tk()
root.withdraw()
  
file_paths = filedialog.askopenfilenames(parent=root, title='Choose a file')

file_path = file_paths[0] 
unzip_path = os.path.join(os.path.expanduser('~'),'Desktop')

   
with zipfile.ZipFile(file_path, 'r') as existing_zip:
    existing_zip.extractall(unzip_path)

 

Posted by 오늘보다 나은 내일
카테고리 없음2022. 4. 7. 14:03

solc --> covtol

Posted by 오늘보다 나은 내일
카테고리 없음2022. 4. 4. 21:46
pip3 install jupyter-tabnine --user
jupyter nbextension install --py jupyter_tabnine --user
jupyter nbextension enable --py jupyter_tabnine --user
jupyter serverextension enable --py jupyter_tabnine --user
Posted by 오늘보다 나은 내일
카테고리 없음2021. 8. 30. 21:29

Reservation.7z
0.00MB

 

캠핑장 예약 Python Code

Posted by 오늘보다 나은 내일
카테고리 없음2021. 6. 15. 12:16

ACT_NumPy_Ex3.xml

---------------------------------------------------------------------------------------------------------------

<extension version="192" minorversion="0" name="ACT_NumPy_Ex3">
    <guid shortid="ACT_NumPy_Ex3">98V1CB96-4EEE-4DF2-AA62-EC8F9838543A</guid>
    <author>SanthoshM</author>
    <description> Asd
    </description>
    <script src="main.py" compiled="true"/>
    <script src="A_NumpyFun3.py" compiled="true"/>
    <interface context="Mechanical">
        <images>images</images>
        <callbacks>
            <oninit>init</oninit>
        </callbacks>

        <toolbar name = "ACT_NumPy_Ex3" caption = "ACT_NumPy_Ex3">
            <entry name = "ACT_NumPy_Ex3" icon = "hand">
                <callbacks>
                    <onclick>CreateCustomPost</onclick>
                </callbacks>
            </entry>
        </toolbar>
    </interface>
    
    
        <simdata context ="Mechanical">
        
            <result name="CustomRes" version="1" caption="CustomNumPyRes" icon="hand" location="node" type="scalar" >
                <callbacks>
                    <evaluate>Manupulate</evaluate>
                </callbacks>
                
                <property name="Geometry" caption="Geometry" control="scoping"> </property>
                <property name="DispFactor" caption="DispFactor" control="float" default="5.0"> </property>
                <property name="InputFileName" caption="Input csv File Name" control="text" default="auto" readonly="true"> </property>
                <property name="OutputFileName" caption="Output csv File Name" control="text" default="auto" readonly="true"> </property>
                
            </result>
        
        </simdata>
        
</extension>

 

---------------------------------------------------------------------------------------------------------------

 

main3.py

 

---------------------------------------------------------------------------------------------------------------

https://stackoverflow.com/questions/66887591/ansys-ironpython-act-does-not-run

 

Ansys ironpython ACT does not run

I am trying to make the code work from the 9-17min mark in this youtube video: https://www.youtube.com/watch?v=oX5hDU0Qg-Q I wrote down every single line of code and it should work, however I get the

stackoverflow.com

 

def __init__(context): ExtAPI.Log.WriteMessage("initiating Scipy manipulate...") pass def CreateCustomPost(analysis): ExtAPI.Log.WriteMessage("clicked on CustomPost button") result=analysis.CreateResultObject("CustomPost")

Posted by 오늘보다 나은 내일