Python pandas與windows換行大坑

(function(w,d,s,l,i))(window,document,'script','dataLayer','GTM-KDKMGT');
(function(d, s, id) var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/zh_TW/all.js#xfbml=1&appId=668497826514848"; fjs.parentNode.insertBefore(js, fjs); (document, 'script', 'facebook-jssdk'));






if (User.Login.isLogin())
var BAHAID = User.Login.getUserid(),
BAHAIDlow = BAHAID.toLowerCase();

document.write('');

document.write('

');
document.write('');
document.write('');
document.write('');
document.write('

');

document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
document.write('
');
NOTIFY_getnum();
run30 = setInterval("NOTIFY_getnum()",60000);

else
document.write('
');
document.write('');
document.write('
    ');
    document.write('
  • 我要登入
  • ');
    document.write('
  • 註冊
  • ');
    document.write('
  • ');
    document.write('
');
document.write('
');


document.write('
');

document.write(' ');

(function()
var cx = 'partner-pub-9012069346306566:kd3hd85io9c';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
)();

service = new rsearch('rsearch');

function insideSecondaryfunc(frm, evt){
if( 0
















breadCrumbs(122, '', 'homeuid=choujim')








    breadCrumbs_listMenu(122, 0, 'homeuid=choujim')





    創作內容





    1 GP


    Python pandas與windows換行大坑


    作者:Fat│2018-11-27 10:55:11│贊助:2│人氣:56

    以前明明就踩過這個爛坑了.....


    (windows環境)



    Python裡面pandas就很方便



    dataframe想幹嘛就幹嘛



    想讀csv就讀 想寫檔就寫



    然而 寫完檔直接暴死 別的程式一讀取 世界都不一樣了






    (゚Д゚≡゚Д゚) 什...什麼?為什麼會不相等呢??



    對 猜得不錯



    就是windows又在搞事



    dataframe.read_csv() 會正常讀取csv檔案 沒事情



    而dataframe.to_csv()想將dataframe內容輸出成csv檔案時

    windows忍不住下手了



    "欸~你這個換行喔 怎麼只有n? 我來幫你一把吧!"

    (一陣忙碌)

    "登登~你看!我幫你把換行弄成rn了 很棒吧 不用謝了 小事一樁"



    在windows好心幫忙下 當你用n去切出一行內容時



    筍乾爆炸!



    你以為你的內容是age但其實不是 而是ager 但r不會顯示出來呢



    windows上你去to_csv()參數強制設定結尾為n 他也不會屌你



    所以最終該怎麼做ㄋ?




    with open(file path, mode='w', newline='n') as f:

                dataframe.to_csv(f)




    這樣







    喜歡1
    收藏
    1
    引用
    0
    留言
    推上首頁



    檢舉








    引用網址:https://home.gamer.com.tw/TrackBack.php?sn=4208162

    All rights reserved. 版權所有,保留一切權利





    相關創作

    同標籤作品搜尋:python|windows





    這麼好用的東西居然被判定成威脅




    如何安裝snowboy (python3) 在Raspberry Pi




    珍惜生命,請遠離還原光碟之重設電腦




    老戰友,一路好走!




    快速 輸入 常用顏文字


    留言共 0 篇留言




    Util.ChangeText('replys', Util.ChangeText.FLAG_LAZYLOAD|Util.ChangeText.FLAG_MAX_SIZE|Util.ChangeText.FLAG_BALA_PLAYER);

    我要留言提醒:您尚未登入,請先登入再留言


    1喜歡★choujim 可決定是否刪除您的留言,請勿發表違反站規文字。



    前一篇:不要用ggpy!...

    後一篇:不可思議事件嗎?...








    egg('.MSG-list8C img').each(function(elem)
    elem.className = elem.className + ' lazyload';
    );

    egg('.gallery-image').imageGallery();

    function deleteCreation(vCode)
    var content = egg('.MSG-list8C').html();
    var pattern = /]*?>/i;
    var html = '
    確定要刪除嗎?';
    var width = '200px';
    if(content.match(pattern))
    html += '
    ';

    var boxConfig =
    'closeButton': false,
    'css':
    'width': width

    ;

    egg.mutbox(html, '訊息',
    '確定': function()
    if(egg('#chkDelTruthImage:checked').size())
    egg('[name=delTruthImage]').val('yes');


    egg.cookie.del('ckHOME_CREATION','home.gamer.com.tw','/');
    egg.cookie.set('ckHOME_CREATION',vCode,'home.gamer.com.tw','/');
    document.getElementById('frmDel').submit();
    egg.lightbox.close();
    ,
    '取消': function()
    egg.lightbox.close();

    ,boxConfig);

    var buttonOk = egg('.BH-popbtns :button:eq(0)');
    if(buttonOk.size())
    buttonOk.get(0).focus();



    resizeImage(627);

    egg('.btnGp').click(function()
    $.mutbox('請先登入才能進行此動作', '訊息', '確定':function()location.href='https://user.gamer.com.tw/login.php';);
    );







    追蹤私訊


    作品資料夾


    美版quiz rpg (13)


    繁中quiz rpg (74)


    Tetris (5)


    少女前線 (17)


    小筆記 (4)


    瞎玩 (2)


    未分類 (0)


    Allen87828
    我愛你看更多我要大聲說昨天21:31







    googletag.cmd.push(function() googletag.display('div-gpt-ad-1489070677458-0'); );



    (function(window, $)
    var $window = $(window);
    var $document = $(document);
    var $BH_slave = $("#BH-slave");
    var $BH_master = $("#BH-master");
    var $flySalve = $("#flySalve");
    var posY = $flySalve.position().top;
    var fad_style = document.getElementById("flySalve").style;
    var BH_wrapper_width = $('#BH-wrapper').width();
    var BH_topBar_height = $('.TOP-bh').height();
    $(window).on("scroll", function()
    posY = $BH_slave.height() - (fad_style.position === 'fixed' ? 0 : $flySalve.height());

    if ($document.scrollTop() > (posY + $BH_slave.offset().top - BH_topBar_height) && $BH_slave.height() < $BH_master.height())
    fad_style.position = 'fixed';
    fad_style.top = BH_topBar_height + 'px';
    if ($(window).width() < BH_wrapper_width)
    fad_style.left = (BH_wrapper_width - $BH_slave.width() - $document.scrollLeft())+'px';

    else
    fad_style.position = '';

    ).on("resize", function()
    fad_style.left = null;
    );
    )(window, jQuery);
















    face我們了解您不想看到廣告的心情⋯ 若您願意支持巴哈姆特永續經營,請將 gamer.com.tw 加入廣告阻擋工具的白名單中,謝謝 !【教學】





    The name of the picture黑色沙漠手遊伺服器是巴雷諾斯公會缺人名稱是GO歡迎大家查詢到後加入

    This page is only for reference, If you need detailed information, please check here
    The name of the pictureThe name of the picture

    Popular posts from this blog

    京昆高速公路

    [翻譯?] 就此消失吧

    【心得】新、舊選單《獨立快捷鍵 / 快捷列》增加、更改(圖解)